Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release on tag #4208

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .cloudgov/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ applications:
services:
- app-((env))-uaa-client
- federalist-((env))-rds
- ((product))-((env))-env
- pages-((env))-env
- pages-((env))-redis
- ((product))-((env))-proxy
- ((product))-((env))-domain
- pages-((env))-proxy
- pages-((env))-domain
- federalist-((env))-uev-key
- federalist-deploy-user
- federalist-site-wide-error
Expand All @@ -47,17 +47,17 @@ applications:
UAA_HOST: ((uaa_host))
NEW_RELIC_APP_NAME: ((new_relic_app_name))
PROXY_DOMAIN: ((proxy_domain))
PRODUCT: ((product))
PRODUCT: pages
CF_CDN_SPACE_NAME: ((cf_cdn_space_name))
CF_DOMAIN_WITH_CDN_PLAN_GUID: 440cce96-8989-428b-a60e-91c1393bf3f2
NEW_RELIC_ERROR_COLLECTOR_ENABLED: false
- name: ((product))-admin((env_postfix))
- name: pages-admin((env_postfix))
buildpack: staticfile_buildpack
path: ../admin-client
instances: 2
routes:
- route: admin.((domain))
- name: ((product))-queues-ui((env_postfix))
- name: pages-queues-ui((env_postfix))
buildpack: nodejs_buildpack
command: yarn start-bull-board:cg
disk_quota: 2G
Expand All @@ -67,8 +67,8 @@ applications:
- route: queues.((domain))
services:
- app-((env))-uaa-client
- ((product))-((env))-redis
- ((product))-((env))-env
- pages-((env))-redis
- pages-((env))-env
env:
ADMIN_GITHUB_ORGANIZATION: 18F
ADMIN_GITHUB_TEAM: federalist-admins
Expand All @@ -79,4 +79,4 @@ applications:
NPM_CONFIG_PRODUCTION: true
NODE_MODULES_CACHE: false
UAA_LOGIN_HOST: ((uaa_login_host))
PRODUCT: ((product))
PRODUCT: pages
50 changes: 17 additions & 33 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ To deploy to CloudFoundry submit the following:
`cf push federalistapp --strategy rolling --vars-file "./.cloudgov/vars/${CF_SPACE}.yml" -f ./cloudgov/manifest.yml`

### Continuous Integration
We are in the process of migrating from CircleCI to an internal instance of Concourse CI, starting with our staging environment. To use Concourse, one must have appropriate permissions in UAA as administered by the cloud.gov operators. Access to Concourse also requires using the GSA VPN.
Our continuous integration pipeline is run on Concourse CI. To use Concourse, one must have appropriate permissions in UAA as administered by the cloud.gov operators. Access to Concourse also requires using the GSA VPN.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Access to Concourse also requires using the GSA VPN.

Maybe it's beyond the scope of this documentation, but Zscaler changes this, or is at least in the process of doing so.


1. To get started install and authenticate with the `fly` CLI:
- `brew install --cask fly`
Expand All @@ -172,26 +172,29 @@ We are in the process of migrating from CircleCI to an internal instance of Conc
2. Update local credential files (see ci/vars/example.yml)

#### CI deployments
This repository contains two distinct deployment pipelines in concourse:
- [__Core__](./ci/pipeline.yml)
This repository contains three distinct deployment pipelines for the core application and one for metrics:
- [__Core Production__](./ci/pipeline-production.yml)
- [__Core Staging__](./ci/pipeline-staging.yml)
- [__Core Dev__](./ci/pipeline-dev.yml)
- [__Metrics__](./apps/metrics/ci/pipeline.yml)

__Core__ deploys the Pages app/api, the admin app, and the queues app. __Metrics__ deploys concourse tasks to check our app/infrastructure health.
__Core [Env]__ deploys the Pages app/api, the admin app, and the queues app for a given environment. __Metrics__ deploys concourse tasks to check our app/infrastructure health.

__*↓ NOTICE ↓*__

> __Core Dev__ deploys the Pages app/api, the admin app, and the queues app when a PR is created into the `staging` branch. This uses a unique pipeline file: [./ci/pipeline-dev.yml](./ci/pipeline-dev.yml)
> __Core Production__ deploys the Pages app/api, the admin app, and the queues app when a new tag is added to the `main` branch. This uses a unique pipeline file: [./ci/pipeline-production.yml](./ci/pipeline-production.yml). This pipeline is also responsible for creating and updating our release PRs.

> __Core Staging__ deploys the Pages app/api, the admin app, and the queues app when a new commit is added to the `main` branch. This also tests PRs against `main`. This uses a unique pipeline file: [./ci/pipeline-staging.yml](./ci/pipeline-staging.yml)

> __Core Dev__ deploys the Pages app/api, the admin app, and the queues app when a PR is created into the `main` branch. This uses a unique pipeline file: [./ci/pipeline-dev.yml](./ci/pipeline-dev.yml)

#### Core deployment
##### Pipeline instance variables
Three instances of the pipeline are set for the `pages dev`, `pages staging` and `pages production` environments. Instance variables are used to fill in Concourse pipeline parameter variables bearing the same name as the instance variable. See more on [Concourse vars](https://concourse-ci.org/vars.html). Each instance of the pipeline has three instance variables associated to it: `deploy-env`, `git-branch`. `product`
Three instances of the pipeline are set for the `pages dev`, `pages staging` and `pages production` environments. Instance variables are used to fill in Concourse pipeline parameter variables bearing the same name as the instance variable. See more on [Concourse vars](https://concourse-ci.org/vars.html). Each instance of the pipeline has one instance variable associated to it: `deploy-env`.

|Instance Variable|Pages Dev|Pages Staging|Pages Production|
--- | --- | ---| ---|
|**`deploy-env`**|`dev`|`staging`|`production`|
|**`git-branch`**|`staging`|`staging`|`main`|
|**`product`**|`pages`|`pages`|`pages`|

##### Pipeline credentials
Concourse CI integrates directly with [Credhub](https://docs.cloudfoundry.org/credhub/) to provide access to credentials/secrets at job runtime. When a job is started, Concourse will resolve the parameters within the pipeline with the latest credentials using the double parentheses notation (ie. `((<credential-name>))`). See more about the [credentials lookup rules](https://concourse-ci.org/credhub-credential-manager.html#credential-lookup-rules).
Expand All @@ -202,7 +205,7 @@ Some credentials in this pipeline are "compound" credentials that use the pipeli
--- | --- | --- |
|**`((deploy-env))-cf-username`**|The deployment environments CloudFoundry deployer username based on the instanced pipeline|:white_check_mark:|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either "development environment's" or "development environment".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping these because they aren't part of this PR (will catch on a larger docs review)

|**`((deploy-env))-cf-username`**|The deployment environments CloudFoundry deployer password based on the instanced pipeline|:white_check_mark:|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either "development environment's" or "development environment".

|**`((deploy-env))-((product))-domain`**|The deployment envinronment and product(Pages|Federalist) specific domain for the app|:white_check_mark:|
|**`((deploy-env))-pages-domain`**|The deployment environment specific domain for the app|:white_check_mark:|
|**`((slack-channel))`**| Slack channel | :x:|
|**`((slack-username))`**| Slack username | :x:|
|**`((slack-icon-url))`**| Slack icon url | :x:|
Expand All @@ -213,25 +216,12 @@ Some credentials in this pipeline are "compound" credentials that use the pipeli
|**`((gh-access-token))`**| The Github access token|:x:|

##### Setting up the pipeline for Core
The pipeline and each of it's instances will only needed to be set once per instance to create the initial pipeline. After the pipelines are set, updates to the respective `git-branch` source will automatically set the pipeline. See the [`set_pipeline` step](https://concourse-ci.org/set-pipeline-step.html) for more information. Run the following command with the fly CLI to set a pipeline instance:

```bash
$ fly -t <Concourse CI Target Name> set-pipeline -p core \
-c ci/pipeline.yml \
-i git-branch=main \
-i deploy-env=production
-i product=pages
```

##### Setting up the pipeline for Core Dev
The pipeline and each of it's instances will only needed to be set once per instance to create the initial pipeline. After the pipelines are set, updates from a source PR will automatically set the pipeline. See the [`set_pipeline` step](https://concourse-ci.org/set-pipeline-step.html) for more information. Run the following command with the fly CLI to set a pipeline instance:
The pipeline and each of it's instances will only needed to be set once per instance to create the initial pipeline. After the pipelines are set, updates to the default branch will automatically set the pipeline. See the [`set_pipeline` step](https://concourse-ci.org/set-pipeline-step.html) for more information. Run the following command with the fly CLI to set a pipeline instance:

```bash
$ fly -t <Concourse CI Target Name> set-pipeline -p core \
-c ci/pipeline-dev.yml \
-i git-branch=staging \
-i deploy-env=dev
-i product=pages
-c ci/pipeline-<env>.yml \
-i deploy-env=<env>
```

##### Getting or deleting a pipeline instance from the CLI
Expand All @@ -240,11 +230,11 @@ To get a pipeline instance's config or destroy a pipeline instance, Run the foll
```bash
## Get a pipeline instance config
$ fly -t <Concourse CI Target Name> get-pipeline \
-p core/deploy-env:production,git-branch:main,product:pages
-p core/deploy-env:production

## Destroy a pipeline
$ fly -t <Concourse CI Target Name> destroy-pipeline \
-p core/deploy-env:production,git-branch:main,product:pages
-p core/deploy-env:production
```

#### Metrics deployment
Expand Down Expand Up @@ -465,12 +455,6 @@ docs: Close an issue from our product repo
Related issue: https://github.com/cloud-gov/product/issues/2486
```

We also allow one additional commit type: `merge`. This is used in place of the default message for merge commits:

```
merge: pull request #4190 from cloud-gov/4186-pages-admin-pages-logo
```

This convention is enforced via [this ruleset](https://github.com/cloud-gov/pages-core/settings/rules/26912), which checks the commit message against a regex rule before it can be merged to the default branch.

The benefit of adhering to this convention is that we can more easily reason about our commit history and also generate nice changelogs via [Release Please](https://github.com/googleapis/release-please).
Expand Down
5 changes: 2 additions & 3 deletions apps/metrics/ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ jobs:
file: src-metrics/apps/metrics/ci/pipeline.yml
instance_vars:
deploy-env: ((deploy-env))
git-branch: ((git-branch))

############################
# RESOURCES
Expand All @@ -245,7 +244,7 @@ resources:
source:
repository: ((pages-repository-path))
access_token: ((gh-access-token))
base_branch: ((git-branch))
base_branch: main
disable_forks: true
ignore_drafts: false

Expand All @@ -254,7 +253,7 @@ resources:
icon: github
source:
uri: ((git-base-url))/((pages-repository-path))
branch: ((git-branch))
branch: main
commit_verification_keys: ((cloud-gov-pages-gpg-keys))

- name: slack
Expand Down
7 changes: 7 additions & 0 deletions ci/partials/build-admin-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
platform: linux
inputs: [name: src]
outputs: [name: src]
run:
dir: src/admin-client
path: bash
args: [-c, yarn build]
9 changes: 9 additions & 0 deletions ci/partials/build-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
platform: linux
inputs: [name: src]
outputs: [name: src]
params:
PRODUCT: pages
run:
dir: src
path: bash
args: [-c, yarn build]
4 changes: 4 additions & 0 deletions ci/partials/cancel-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
platform: linux
inputs: [name: src]
run:
path: src/ci/tasks/cancel-deployment.sh
6 changes: 6 additions & 0 deletions ci/partials/configure-nginx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
platform: linux
inputs: [name: src]
outputs: [name: src]
run:
dir: src
path: ci/tasks/configure-admin-client-nginx.sh
4 changes: 4 additions & 0 deletions ci/partials/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
platform: linux
inputs: [name: src]
run:
path: src/ci/tasks/deploy.sh
7 changes: 7 additions & 0 deletions ci/partials/install-deps-admin-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
platform: linux
inputs: [name: src]
outputs: [name: src]
run:
dir: src/admin-client
path: bash
args: [-c, yarn --pure-lockfile]
7 changes: 7 additions & 0 deletions ci/partials/install-deps-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
platform: linux
inputs: [name: src]
outputs: [name: src]
run:
dir: src
path: bash
args: [-c, yarn --pure-lockfile]
6 changes: 6 additions & 0 deletions ci/partials/lint-admin-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
platform: linux
inputs: [name: src]
run:
dir: src/admin-client
path: bash
args: [-c, yarn lint]
6 changes: 6 additions & 0 deletions ci/partials/lint-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
platform: linux
inputs: [name: src]
run:
dir: src
path: bash
args: [-c, yarn lint]
4 changes: 4 additions & 0 deletions ci/partials/restage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
platform: linux
inputs: [name: src]
run:
path: src/ci/tasks/restage.sh
4 changes: 4 additions & 0 deletions ci/partials/run-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
platform: linux
inputs: [name: src]
run:
path: src/ci/tasks/run-task.sh
22 changes: 22 additions & 0 deletions ci/partials/test-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
platform: linux
image_resource:
type: docker-image
source:
repository: karlkfi/concourse-dcind
inputs:
- name: src
- name: redis
- name: postgres
- name: node
run:
dir: src
path: ci/docker/entrypoint.sh
args:
- bash
- -ceux
- |
docker network prune -f
docker-compose -f ci/docker/docker-compose.yml run app app/ci/tasks/test-api.sh
docker-compose -f ci/docker/docker-compose.yml down
docker volume rm $(docker volume ls -q)
docker network prune -f
Loading
Loading