From 1106a1b225ab9a26649aa797b507e66354ff33c0 Mon Sep 17 00:00:00 2001 From: Jared Murrell Date: Thu, 13 Aug 2020 18:30:26 -0400 Subject: [PATCH] changed default repo to .github --- .env.example | 23 ++++++++++++-------- .github/README.md | 51 ++++++++++++++++++++++++++++---------------- lib/RallyValidate.js | 2 +- 3 files changed, 48 insertions(+), 28 deletions(-) diff --git a/.env.example b/.env.example index 275d277..e26cd35 100644 --- a/.env.example +++ b/.env.example @@ -1,26 +1,31 @@ # The ID of your GitHub App -APP_ID= +APP_ID=12345 + +# The webhook secret for GitHub WEBHOOK_SECRET=development +# The name of your bot +BOT_NAME=Rally + # Set the NODE_ENV -# NODE_ENV=production +NODE_ENV=production # Uncomment this to get verbose logging; use `info` to show less -# LOG_LEVEL=trace +LOG_LEVEL=info # Go to https://smee.io/new set this to the URL that you are redirected to. # WEBHOOK_PROXY_URL= # Uncomment the following line and use your own GitHub Enterprise # instance if this will not be used on https://github.com -# GHE_HOST=github.example.com +GHE_HOST=github.example.com # This setting should ONLY be used for testing with # a self-signed certificate or when a proxy is causing certificate issues # NODE_TLS_REJECT_UNAUTHORIZED=0 # Create a private key in your organization and reference the path here -PRIVATE_KEY_PATH=/opt/rally/.ssh/rally.pem +PRIVATE_KEY_PATH=.ssh/rally.pem ############################# # Rally connection settings # @@ -35,13 +40,13 @@ RALLY_SERVER=https://rally1.rallydev.com # NOTE: This is not required if you are using an API key, # which is the preferred method # Example: RALLY_USERNAME=rallyuser -RALLY_USERNAME= +#RALLY_USERNAME= # Password to connect and access all Rally information # NOTE: This is not required if you are using an API key, # which is the preferred method # Example: RALLY_PASSWORD=Som3C0olP@ssword! -RALLY_PASSWORD= +#RALLY_PASSWORD= # API Key for connecting to Rally # Example: RALLY_API_KEY=123abCD... @@ -61,6 +66,6 @@ ENFORCE_ALL_REPOS=false # will look for .github/rally.yml in the config repository. If # a file doesn't exist, it will search for a repo-specific configuration # If not set, this will look for a default repo at -# [ORG_NAME}/rally-github-config +# [ORG_NAME}/.github # Example ORG_CONFIG_REPO_NAME=my-custom-config-repo -ORG_CONFIG_REPO_NAME=rally-validator-config +ORG_CONFIG_REPO_NAME=.github diff --git a/.github/README.md b/.github/README.md index f97351e..05e54b7 100644 --- a/.github/README.md +++ b/.github/README.md @@ -32,32 +32,46 @@ checkPRTitle: true # Check all commit messages for a Rally story/defect (true | false) checkCommitMessages: true -# Which projects this repo will link to -rallyProjects: ['Sample Project', 'devops-engineering'] - -# List of valid Rally artifacts to check - # Valid values: - # defect - # defectsuite - # task - # testcase - # hierarchicalrequirement - # userstory - # story -rallyObjects: ['defect', 'userstory'] - -# List of Rally statuses that an issue must be in in order to pass -artifactStatuses: ['Defined', 'In-Progress'] +# Set Rally Flow State to Complete on merge if the PR Body contains "/completes " +mergeOnPRBody: true # Comment on the PR in addition to the check message? (true | false) commentOnPull: false rally: - # Optionally override the global Rally URL server: https://rally1.rallydev.com + + ## Leave these blank if you use an API key + ##username: rallyUser + ##password: rallyPass + ## This is required if we don't use username/password + ## NOTE: If you set this in your .env file then you can + ## leave this commented out. It will override your .env + #api_key: _1234abc567... + # Which workspace OID this repo will link to workspace: 12345 + # Which projects this repo will link to. + # To have it connect to any project, leave this value blank + projects: + - Sample Project + - devops-engineering + + # List of valid Rally objects to check + objects: + - defect + #- defectsuite + #- task + #- testcase + #- hierarchicalrequirement + - userstory + #- story + + # List of Rally states that an issue must be in in order to pass + states: + - Defined + - In-Progress ``` ### Creating the GitHub App on your GitHub instance @@ -123,6 +137,7 @@ nohup npm start 2>&1 >> /path/to/output.log & ### Environment Variables - `APP_ID` - The App ID of the **GitHub App** +- `BOT_NAME` - The name of the bot - `WEBHOOK_SECRET` - The secret to prevent man in the middle attacks - `GHE_HOST` - This is a required field for **GitHub Enterprise Server** implementations (_Example: github.mycompany.com_) - `RALLY_SERVER` - URL to connect to **Rally** @@ -131,7 +146,7 @@ nohup npm start 2>&1 >> /path/to/output.log & - `RALLY_API_KEY` - API key to authenticate to **Rally** instead of `RALLY_USERNAME` and `RALLY_PASSWORD` ![rally-token](https://user-images.githubusercontent.com/2894107/89300774-56b89b00-d62e-11ea-94c9-066e12ac5246.png) - `ENFORCE_ALL_REPOS` - **true** or **false**, will set enforcement of `Rally + GitHub` on all repositories in the installed Organization -- `ORG_CONFIG_REPO_NAME` - Repository name where an organization-level configuration can set default behavior for all repositories (Default: `rally-github-config`) +- `ORG_CONFIG_REPO_NAME` - Repository name where an organization-level configuration can set default behavior for all repositories (Default: `.github`) One of the following is **required**: - `PRIVATE_KEY` - The contents of the private key for your **GitHub App**. If you're unable to use multi-line environment variables, use base64 encoding to convert the key to a single line string. diff --git a/lib/RallyValidate.js b/lib/RallyValidate.js index b2d7cd4..2f95e9b 100644 --- a/lib/RallyValidate.js +++ b/lib/RallyValidate.js @@ -83,7 +83,7 @@ class RallyValidate { */ async getDefaultConfig (context) { const noFile = true - const orgConfigRepoName = process.env.ORG_CONFIG_REPO_NAME ? process.env.ORG_CONFIG_REPO_NAME : 'rally-github-config' + const orgConfigRepoName = process.env.ORG_CONFIG_REPO_NAME ? process.env.ORG_CONFIG_REPO_NAME : '.github' let orgConfig // Get config default from org-level repo .github/rally/.yml