-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into templatetag
- Loading branch information
Showing
33 changed files
with
608 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,3 @@ | ||
# Contributing | ||
# Contributing to Screwdriver | ||
|
||
Thank you for considering contributing! There are many ways you can help. | ||
|
||
## Issues | ||
|
||
File an issue if you think you've found a bug. Be sure to describe | ||
|
||
1. How can it be reproduced? | ||
2. What did you expect? | ||
3. What actually occurred? | ||
4. Version, platform, etc. if possibly relevant. | ||
|
||
## Docs | ||
|
||
Documentation, READMEs, and examples are extremely important. Please help improve them and if you find a typo or notice a problem, please send a fix or say something. | ||
|
||
## Submitting Patches | ||
|
||
Patches for fixes, features, and improvements are accepted through pull requests. | ||
|
||
* Write good commit messages, in the present tense! (Add X, not Added X). Short title, blank line, bullet points if needed. Capitalize the first letter of the title or bullet item. No punctuation in the title. | ||
* Code must pass lint and style checks. | ||
* All external methods must be documented. | ||
* Include tests to improve coverage and prevent regressions. | ||
* Squash changes into a single commit per feature/fix. Ask if you're unsure how to discretize your work. | ||
|
||
Please ask before embarking on a large improvement so you're not disappointed if it does not align with the goals of the project or owner(s). | ||
|
||
## Commit message format | ||
|
||
We use [semantic-release](https://www.npmjs.com/package/semantic-release), which requires commit messages to be in this specific format: `<type>(<scope>): <subject>` | ||
|
||
* Types: | ||
* feat (feature) | ||
* fix (bug fix) | ||
* docs (documentation) | ||
* style (formatting, missing semi colons, …) | ||
* refactor | ||
* test (when adding missing tests) | ||
* chore (maintain) | ||
* Scope: anything that specifies the scope of the commit. Can be blank or `*` | ||
* Subject: description of the commit. For **breaking changes** that require major version bump, add `BREAKING CHANGE` to the commit message. | ||
|
||
**Examples commit messages:** | ||
* Bug fix: `fix: Remove extra space` | ||
* Breaking change: `feat(scm): Support new scm plugin. BREAKING CHANGE: github no longer works` | ||
|
||
## Feature Requests | ||
|
||
Make the case for a feature via an issue with a good title. The feature should be discussed and given a target inclusion milestone or closed. | ||
Have a look at our guidelines, as well as pointers on where to start making changes, in our official [documentation](http://docs.screwdriver.cd/about/contributing/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env node | ||
/** | ||
* Make a user in the database and generate an access token for it | ||
* @param {String} username Username for the new user | ||
* @param {String} gitToken Git access token for the user | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/* eslint-disable import/no-dynamic-require */ | ||
/* eslint-disable no-console */ | ||
|
||
// Make sure script is being called correctly | ||
if (process.argv.length !== 4) { | ||
console.log('Usage: npm run create-test-user -- $username $git-token'); | ||
|
||
return 1; | ||
} | ||
|
||
const username = process.argv[2]; | ||
const gitToken = process.argv[3]; | ||
|
||
const config = require('config'); | ||
const hoek = require('hoek'); | ||
|
||
// Setup Authentication | ||
const authConfig = config.get('auth'); | ||
|
||
// Setup HTTPd | ||
const httpdConfig = config.get('httpd'); | ||
|
||
// Special urls for things like the UI | ||
const ecosystem = config.get('ecosystem'); | ||
|
||
ecosystem.api = httpdConfig.uri; | ||
|
||
// Setup Datastore | ||
const datastoreConfig = config.get('datastore'); | ||
const DatastorePlugin = require(`screwdriver-datastore-${datastoreConfig.plugin}`); | ||
const datastore = new DatastorePlugin(hoek.applyToDefaults({ ecosystem }, | ||
(datastoreConfig[datastoreConfig.plugin] || {}))); | ||
|
||
// Source Code Plugin | ||
const scmConfig = config.get('scm'); | ||
const ScmPlugin = require(`screwdriver-scm-${scmConfig.plugin}`); | ||
const scm = new ScmPlugin(hoek.applyToDefaults({ ecosystem }, | ||
(scmConfig[scmConfig.plugin] || {}))); | ||
|
||
authConfig.scm = scm; | ||
|
||
// Setup Model Factories | ||
const Models = require('screwdriver-models'); | ||
const userFactory = Models.UserFactory.getInstance({ | ||
datastore, | ||
scm, | ||
password: authConfig.encryptionPassword | ||
}); | ||
const tokenFactory = Models.TokenFactory.getInstance({ | ||
datastore | ||
}); | ||
|
||
// Setup datastore and create test user | ||
return datastore.setup() | ||
.then(() => userFactory.get({ username })) | ||
.then((model) => { | ||
if (!model) { | ||
return userFactory.create({ | ||
username, | ||
token: gitToken | ||
}); | ||
} | ||
|
||
return model.sealToken(gitToken) | ||
.then((token) => { | ||
model.token = token; | ||
|
||
return model.update(); | ||
}); | ||
}) | ||
.then(testUser => tokenFactory.create({ | ||
name: 'Functional test token', | ||
userId: testUser.id | ||
})) | ||
.then(token => console.log(`Token created for user ${username}: ${token.value}`)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Scripts | ||
|
||
Scripts used for setting up functional tests | ||
|
||
### Creating a test user | ||
|
||
The script `create-test-user` will create a user in your database. Run this script with a username and SCM access token, and the script will create the user and print an API token for use in tests to `stdout`. | ||
|
||
```bash | ||
$ npm run create-test-user -- test-user git-access-token | ||
``` | ||
|
||
Put the token generated by the script in your `.func_config` file (or set it as an environment variable) as `API_TOKEN`. | ||
|
||
In addition, you will have to remove the `temporaryAccessUser` and `temporaryAccessKey` from your `screwdriver/config/local.yaml`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.