Skip to content

Commit 0a1cd32

Browse files
committed
add whitespace
1 parent 8aa996b commit 0a1cd32

5 files changed

Lines changed: 18 additions & 7 deletions

File tree

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,34 +328,41 @@ terraform destroy -var-file=env/dev/dev.tfvars
328328
### Deployments with Concourse
329329

330330
#### Allowlisting your IP
331+
331332
To setup the deployment pipeline with concourse, you must first allowlist your IP address on the Concourse
332333
server. IP addresses are flushed everyday at 00:00 so this must be done at the beginning of every working day
333334
whenever the deployment pipeline needs to be used. Follow the instructions on the Confluence page (SDP Homepage > SDP Concourse > Concourse Login) to
334335
login. All our pipelines run on sdp-pipeline-prod, whereas sdp-pipeline-dev is the account used for
335336
changes to Concourse instance itself. Make sure to export all necessary environment variables from sdp-pipeline-prod (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN).
336337

337338
#### Setting up a pipeline
339+
338340
When setting up our pipelines, we use ecs-infra-user on sdp-dev to be able to interact with our infrastructure on AWS. The credentials for this are stored on
339341
AWS Secrets Manager so you do not need to set up anything yourself.
340342

341343
To set the pipeline, run the following script:
344+
342345
```bash
343346
chmod u+x ./concourse/scripts/set_pipeline.sh
344347
./concourse/scripts/set_pipeline.sh github-repo-archive-script
345348
```
349+
346350
Note that you only have to run chmod the first time running the script in order to give permissions.
347351
This script will set the branch and pipeline name to whatever branch you are currently on. It will also set the image tag on ECR to the current commit hash at the time of setting the pipeline.
348352

349353
The pipeline name itself will usually follow a pattern as follows: `<repo-name>-<branch-name>`
350354
If you wish to set a pipeline for another branch without checking out, you can run the following:
355+
351356
```bash
352357
./concourse/scripts/set_pipeline.sh github-repo-archive-script <branch_name>
353358
```
354359

355360
If the branch you are deploying is "main" or "master", it will trigger a deployment to the sdp-prod environment. To set the ECR image tag, you must draft a Github release pointing to the latest release of the main/master branch that has a tag in the form of vX.Y.Z. Drafting up a release will automatically deploy the latest version of the main/master branch with the associated release tag, but you can also manually trigger a build through the Concourse UI or the terminal prompt.
356361

357362
#### Triggering a pipeline
363+
358364
Once the pipeline has been set, you can manually trigger a build on the Concourse UI, or run the following command:
365+
359366
```bash
360367
fly -t aws-sdp trigger-job -j github-repo-archive-script-<branch-name>/build-and-push
361368
```

concourse/scripts/assume_role.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ aws sts assume-role --output text \
88
--role-session-name concourse-pipeline-run \
99
--query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" \
1010
| awk -F '\t' '{print $1 > ("AccessKeyId")}{print $2 > ("SecretAccessKey")}{print $3 > ("SessionToken")}'
11-
# shellcheck disable=SC3040,SC2154
12-
1311

12+
# shellcheck disable=SC3040,SC2154
1413
AWS_ACCESS_KEY_ID="$(cat AccessKeyId)"
1514
AWS_SECRET_ACCESS_KEY="$(cat SecretAccessKey)"
1615
AWS_SESSION_TOKEN="$(cat SessionToken)"

concourse/scripts/build_image.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ set -euo pipefail
55
export STORAGE_DRIVER=vfs
66
export PODMAN_SYSTEMD_UNIT=concourse-task
77

8+
# shellcheck disable=SC2154
89
container_image=$(echo "$secrets" | jq -r .container_image)
910

1011
# shellcheck disable=SC2154
1112
aws ecr get-login-password --region eu-west-2 | podman --storage-driver=vfs login --username AWS --password-stdin "${aws_account_id}".dkr.ecr.eu-west-2.amazonaws.com
1213

14+
# shellcheck disable=SC2154
1315
podman build -t "${container_image}":"${tag}" resource-repo
1416

17+
# shellcheck disable=SC2154
1518
podman tag "${container_image}":"${tag}" "${aws_account_id}".dkr.ecr.eu-west-2.amazonaws.com/"${container_image}":"${tag}"
19+
20+
# shellcheck disable=SC2154
1621
podman push "${aws_account_id}".dkr.ecr.eu-west-2.amazonaws.com/"${container_image}":"${tag}"
17-
# shellcheck disable=SC2154

concourse/scripts/set_pipeline.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ repo_name=${1}
55
if [[ $# -gt 1 ]]; then
66
branch=${2}
77
git rev-parse --verify "${branch}"
8-
if [[ $? -ne 0 ]]; then # shellcheck disable=SC2181
8+
# shellcheck disable=SC2181
9+
if [[ $? -ne 0 ]]; then
910
echo "Branch \"${branch}\" does not exist"
1011
exit 1
1112
fi
@@ -26,4 +27,3 @@ else
2627
fi
2728

2829
fly -t aws-sdp set-pipeline -c concourse/ci.yml -p "${repo_name}"-"${branch}" -v branch="${branch}" -v tag="${tag}" -v env="${env}"
29-

concourse/scripts/terraform_infra.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ AWS_SECRET_ACCESS_KEY=$aws_secret_access_key
2929
export AWS_ACCESS_KEY_ID
3030
export AWS_SECRET_ACCESS_KEY
3131

32-
git config --global url."https://x-access-token:$github_access_token@github.com/".insteadOf "https://github.com/" # shellcheck disable=
32+
# shellcheck disable=SC2086
33+
git config --global url."https://x-access-token:$github_access_token@github.com/".insteadOf "https://github.com/"
3334

3435
if [[ ${env} != "prod" ]]; then
3536
env="dev"
@@ -39,6 +40,7 @@ cd resource-repo/terraform/service
3940

4041
terraform init -backend-config=env/"${env}"/backend-"${env}".tfbackend -reconfigure
4142

43+
# shellcheck disable=SC2154
4244
terraform apply \
4345
-var "aws_account_id=$aws_account_id" \
4446
-var "aws_access_key_id=$aws_access_key_id" \
@@ -54,4 +56,3 @@ terraform apply \
5456
-var "lambda_memory=$lambda_memory" \
5557
-var "schedule=$schedule" \
5658
-auto-approve
57-
# shellcheck disable=SC2154

0 commit comments

Comments
 (0)