Skip to content

Commit 97417d3

Browse files
committed
style(megalinter): address linting errors
1 parent 669b559 commit 97417d3

5 files changed

Lines changed: 364 additions & 311 deletions

File tree

concourse/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
# Kics linting thinks that the "password" and "github_access_token" keys are secrets, but they are not.
3+
# These instances are ignored appropriately.
4+
15
resource_types:
26
- name: key-value
37
type: registry-image
@@ -11,13 +15,15 @@ resources:
1115
source:
1216
uri: https://github.com/ONS-Innovation/github-repository-archive-script
1317
username: ((github_access_token))
18+
# kics-scan ignore-line
1419
password: x-oauth-basic # checkov:skip=CKV_SECRET_6:Checkov thinks this is a secret, but it is not
1520
branch: ((branch))
1621
- name: github-release
1722
type: github-release
1823
source:
1924
owner: ONS-Innovation
2025
repository: github-repository-archive-script
26+
# kics-scan ignore-line
2127
access_token: ((github_access_token))
2228
- name: github-release-tag
2329
type: key-value
@@ -49,6 +55,7 @@ terraform-task: &terraform-task
4955
- name: github-release-tag
5056
params:
5157
secrets: ((sdp_((env))_repository_archive_script_secrets))
58+
# kics-scan ignore-line
5259
github_access_token: ((github_access_token))
5360
env: ((env))
5461
branch: ((branch))
@@ -236,6 +243,7 @@ jobs:
236243
# additional_tags: release-tag-output/tag
237244
- <<: *terraform-task
238245
params:
246+
# kics-scan ignore-line
239247
github_access_token: ((github_access_token))
240248
env: dev
241249
secrets: ((sdp_dev_repository_archive_script_secrets))
@@ -297,6 +305,7 @@ jobs:
297305
timeout: 10m
298306
- <<: *terraform-task
299307
params:
308+
# kics-scan ignore-line
300309
github_access_token: ((github_access_token))
301310
env: prod
302311
secrets: ((sdp_dev_repository_archive_script_secrets))

concourse/scripts/assume_role.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ set -euo pipefail
77
apk add --no-cache aws-cli podman jq iptables
88

99
aws sts assume-role --output text \
10-
--role-arn "${aws_role_arn}" \
11-
--role-session-name concourse-pipeline-run \
12-
--query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" |
13-
awk -F '\t' '{print $1 > ("AccessKeyId")}{print $2 > ("SecretAccessKey")}{print $3 > ("SessionToken")}'
10+
--role-arn "${aws_role_arn}" \
11+
--role-session-name concourse-pipeline-run \
12+
--query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" |
13+
awk -F '\t' '{print $1 > ("AccessKeyId")}{print $2 > ("SecretAccessKey")}{print $3 > ("SessionToken")}'
1414

1515
AWS_ACCESS_KEY_ID="$(cat AccessKeyId)"
1616
AWS_SECRET_ACCESS_KEY="$(cat SecretAccessKey)"

concourse/scripts/set_pipeline.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ repo_name="repository-archive-script"
1010

1111
# Always use the current branch
1212
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || {
13-
echo "Failed to get branch name"
14-
exit 1
13+
echo "Failed to get branch name"
14+
exit 1
1515
})
1616

1717
if ! git rev-parse --verify "${branch}" >/dev/null 2>&1; then
18-
echo "Branch \"${branch}\" does not exist. Cannot set a pipeline without a valid branch."
19-
exit 1
18+
echo "Branch \"${branch}\" does not exist. Cannot set a pipeline without a valid branch."
19+
exit 1
2020
fi
2121

2222
# Name the pipeline based on the branch
2323
if [[ ${branch} == "main" || ${branch} == "master" ]]; then
24-
pipeline_name=${repo_name}
24+
pipeline_name=${repo_name}
2525
else
26-
# Remove non-alphanumeric characters and take the first 7 characters
27-
sanitized_branch=$(echo "${branch}" | tr -cd '[:alnum:]' | cut -c1-7)
28-
pipeline_name="${repo_name}"-"${sanitized_branch}"
26+
# Remove non-alphanumeric characters and take the first 7 characters
27+
sanitized_branch=$(echo "${branch}" | tr -cd '[:alnum:]' | cut -c1-7)
28+
pipeline_name="${repo_name}"-"${sanitized_branch}"
2929
fi
3030

3131
fly -t aws-sdp set-pipeline -c concourse/ci.yml -p "${pipeline_name}" -v branch="${branch}" -v repo_name="${repo_name}" -v env=dev

concourse/scripts/terraform_infra.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export AWS_SECRET_ACCESS_KEY="$aws_secret_access_key"
2525
git config --global url."https://x-access-token:$github_access_token@github.com/".insteadOf "https://github.com/"
2626

2727
if [ "${env}" != "prod" ]; then
28-
env="dev"
28+
env="dev"
2929
fi
3030

3131
echo "${env}"
@@ -37,14 +37,14 @@ terraform init -backend-config=env/"${env}"/backend-"${env}".tfbackend -reconfig
3737
# The following terraform-apply may need to change if the environment variables change
3838

3939
terraform apply \
40-
-var "aws_account_id=$aws_account_id" \
41-
-var "aws_access_key_id=$aws_access_key_id" \
42-
-var "aws_secret_access_key=$aws_secret_access_key" \
43-
-var "env_name=$env_name" \
44-
-var "lambda_name=${lambda_name}" \
45-
-var "github_app_client_id=$github_app_client_id" \
46-
-var "aws_secret_name=$aws_secret_name" \
47-
-var "github_org=$github_org" \
48-
-var "aws_bucket_name=${aws_bucket_name}" \
49-
-var "lambda_version=${tag}" \
50-
-auto-approve
40+
-var "aws_account_id=$aws_account_id" \
41+
-var "aws_access_key_id=$aws_access_key_id" \
42+
-var "aws_secret_access_key=$aws_secret_access_key" \
43+
-var "env_name=$env_name" \
44+
-var "lambda_name=${lambda_name}" \
45+
-var "github_app_client_id=$github_app_client_id" \
46+
-var "aws_secret_name=$aws_secret_name" \
47+
-var "github_org=$github_org" \
48+
-var "aws_bucket_name=${aws_bucket_name}" \
49+
-var "lambda_version=${tag}" \
50+
-auto-approve

0 commit comments

Comments
 (0)