diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8ad7b87..d863f1b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,6 @@ +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + # To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..adf381d --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,22 @@ +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + +name: Audit + +on: + pull_request: + branches: [main] + +jobs: + audit: + name: Audit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20 + cache: "yarn" + - run: yarn install --frozen-lockfile + - name: Run audit + run: make audit diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml new file mode 100644 index 0000000..4efe9f4 --- /dev/null +++ b/.github/workflows/check-code.yml @@ -0,0 +1,22 @@ +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + +name: Check Code + +on: + pull_request: + branches: [main] + +jobs: + check-code: + name: Check Code + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20 + cache: "yarn" + - run: yarn install --frozen-lockfile + - name: Run check code + run: make check-code diff --git a/.github/workflows/nodejs-audit.yml b/.github/workflows/nodejs-audit.yml deleted file mode 100644 index f378d24..0000000 --- a/.github/workflows/nodejs-audit.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: "Nodejs Audit" - -on: - pull_request: - branches: [ main ] - -jobs: - integration: - name: Nodejs Audit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - - name: Run ci audit task - run: ./ci/vendor/tasks/nodejs-audit.sh diff --git a/.github/workflows/nodejs-check-code.yml b/.github/workflows/nodejs-check-code.yml deleted file mode 100644 index 50e91e2..0000000 --- a/.github/workflows/nodejs-check-code.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'Nodejs Check Code' - -on: - pull_request: - branches: [main] - -jobs: - check-code: - name: Nodejs Check Code - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - - run: yarn install - - name: Run check code - run: make check-code diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 0f1f99d..b680269 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -1,4 +1,8 @@ +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + name: Spelling + on: pull_request: branches: [ main ] @@ -8,9 +12,9 @@ jobs: name: Spell Check with Typos runs-on: ubuntu-latest steps: - - name: Checkout Actions Repository - uses: actions/checkout@v2 - - name: Spell Check Repo - uses: crate-ci/typos@v1.12.12 - with: - config: typos.toml + - name: Checkout Actions Repository + uses: actions/checkout@v3 + - name: Spell Check Repo + uses: crate-ci/typos@master + with: + config: typos.toml diff --git a/.github/workflows/vendor/nodejs-audit.yml b/.github/workflows/vendor/nodejs-audit.yml new file mode 100644 index 0000000..adf381d --- /dev/null +++ b/.github/workflows/vendor/nodejs-audit.yml @@ -0,0 +1,22 @@ +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + +name: Audit + +on: + pull_request: + branches: [main] + +jobs: + audit: + name: Audit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20 + cache: "yarn" + - run: yarn install --frozen-lockfile + - name: Run audit + run: make audit diff --git a/.github/workflows/vendor/nodejs-check-code.yml b/.github/workflows/vendor/nodejs-check-code.yml new file mode 100644 index 0000000..4efe9f4 --- /dev/null +++ b/.github/workflows/vendor/nodejs-check-code.yml @@ -0,0 +1,22 @@ +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + +name: Check Code + +on: + pull_request: + branches: [main] + +jobs: + check-code: + name: Check Code + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20 + cache: "yarn" + - run: yarn install --frozen-lockfile + - name: Run check code + run: make check-code diff --git a/.github/workflows/vendor/spelling.yml b/.github/workflows/vendor/spelling.yml new file mode 100644 index 0000000..b680269 --- /dev/null +++ b/.github/workflows/vendor/spelling.yml @@ -0,0 +1,20 @@ +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + +name: Spelling + +on: + pull_request: + branches: [ main ] + +jobs: + spelling: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v3 + - name: Spell Check Repo + uses: crate-ci/typos@master + with: + config: typos.toml diff --git a/ci/vendir.lock.yml b/ci/vendir.lock.yml index 57e4b1d..94a6f61 100644 --- a/ci/vendir.lock.yml +++ b/ci/vendir.lock.yml @@ -2,8 +2,14 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'fix: REPO_PATH initialization' - sha: 70728a1b62e43be803a337bfae5968b2324f7ea8 + commitTitle: 'chore: use --attach on docker host' + sha: 9d971fd13c024c5f8e6888208a0311178453409d path: . - path: vendor + path: ../.github/workflows/vendor +- contents: + - git: + commitTitle: 'chore: use --attach on docker host' + sha: 9d971fd13c024c5f8e6888208a0311178453409d + path: . + path: ./vendor kind: LockConfig diff --git a/ci/vendir.yml b/ci/vendir.yml index eeb21aa..816bc75 100644 --- a/ci/vendir.yml +++ b/ci/vendir.yml @@ -1,13 +1,28 @@ apiVersion: vendir.k14s.io/v1alpha1 kind: Config +# Relative to ci/ directories: -- path: vendor +- path: ../.github/workflows/vendor + contents: + - path: . # Copy this folder out to .. + git: + url: https://github.com/GaloyMoney/concourse-shared.git + ref: 9d971fd13c024c5f8e6888208a0311178453409d + includePaths: + - shared/actions/* + excludePaths: + - shared/actions/rust-* + newRootPath: shared/actions + +- path: ./vendor contents: - path: . git: url: https://github.com/GaloyMoney/concourse-shared.git - ref: 70728a1b62e43be803a337bfae5968b2324f7ea8 + ref: 9d971fd13c024c5f8e6888208a0311178453409d includePaths: - - shared/**/* - newRootPath: shared + - shared/ci/**/* + excludePaths: + - shared/ci/**/rust-* + newRootPath: shared/ci diff --git a/ci/vendor/actions/nodejs-audit.yml b/ci/vendor/actions/nodejs-audit.yml deleted file mode 100644 index f378d24..0000000 --- a/ci/vendor/actions/nodejs-audit.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: "Nodejs Audit" - -on: - pull_request: - branches: [ main ] - -jobs: - integration: - name: Nodejs Audit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - - name: Run ci audit task - run: ./ci/vendor/tasks/nodejs-audit.sh diff --git a/ci/vendor/actions/nodejs-check-code.yml b/ci/vendor/actions/nodejs-check-code.yml deleted file mode 100644 index 50e91e2..0000000 --- a/ci/vendor/actions/nodejs-check-code.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'Nodejs Check Code' - -on: - pull_request: - branches: [main] - -jobs: - check-code: - name: Nodejs Check Code - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - - run: yarn install - - name: Run check code - run: make check-code diff --git a/ci/vendor/actions/spelling.yml b/ci/vendor/actions/spelling.yml deleted file mode 100644 index 556acf7..0000000 --- a/ci/vendor/actions/spelling.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Spelling -on: - pull_request: - branches: [ main ] - -jobs: - spelling: - name: Spell Check with Typos - runs-on: ubuntu-latest - steps: - - name: Checkout Actions Repository - uses: actions/checkout@v2 - - name: Spell Check Repo - uses: crate-ci/typos@master - with: - config: typos.toml diff --git a/ci/vendor/actions/test-integration.yml b/ci/vendor/actions/test-integration.yml deleted file mode 100644 index 0c00e71..0000000 --- a/ci/vendor/actions/test-integration.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: "Integration Tests" - -on: - pull_request: - branches: [ main ] - -jobs: - integration: - name: Integration Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Run integration tests - run: docker compose -f docker-compose.yml run integration-tests diff --git a/ci/vendor/config/git-cliff.toml b/ci/vendor/config/git-cliff.toml index b172d45..3404a4f 100644 --- a/ci/vendor/config/git-cliff.toml +++ b/ci/vendor/config/git-cliff.toml @@ -1,3 +1,6 @@ +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + # configuration file for git-cliff (0.1.0) [changelog] diff --git a/ci/vendor/nodejs-dependabot.yml b/ci/vendor/nodejs-dependabot.yml deleted file mode 100644 index 8ad7b87..0000000 --- a/ci/vendor/nodejs-dependabot.yml +++ /dev/null @@ -1,11 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: -- package-ecosystem: "npm" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "daily" diff --git a/ci/vendor/pipeline-fragments.lib.yml b/ci/vendor/pipeline-fragments.lib.yml index 40efd68..d732327 100644 --- a/ci/vendor/pipeline-fragments.lib.yml +++ b/ci/vendor/pipeline-fragments.lib.yml @@ -67,7 +67,7 @@ plan: - name: pipeline-tasks - name: repo run: - path: pipeline-tasks/ci/vendor/tasks/check-code.sh + path: pipeline-tasks/ci/vendor/tasks/nodejs-check-code.sh on_failure: #@ slack_failure_notification() #@ end @@ -89,7 +89,7 @@ plan: - path: cargo-home - path: cargo-target-dir run: - path: pipeline-tasks/ci/vendor/tasks/check-code.sh + path: pipeline-tasks/ci/vendor/tasks/rust-check-code.sh on_failure: #@ slack_failure_notification() #@ end @@ -111,13 +111,53 @@ plan: outputs: - name: bundled-deps run: - path: pipeline-tasks/ci/vendor/tasks/cache-yarn-deps.sh + path: pipeline-tasks/ci/vendor/tasks/nodejs-cache-yarn-deps.sh - put: bundled-deps params: file: bundled-deps/bundled-deps-*.tgz on_failure: #@ slack_failure_notification() #@ end +#@ def test_on_docker_host(container, additional_params={}): +#@ params = dict(additional_params) +#@ params["REPO_PATH"] = data.values.gh_repository + "-" + container +#@ params["GOOGLE_CREDENTIALS"] = "((staging-gcp-creds.creds_json))" +#@ params["SSH_PRIVATE_KEY"] = "((staging-ssh.ssh_private_key))" +#@ params["SSH_PUB_KEY"] = "((staging-ssh.ssh_public_key))" +#@ params["TEST_CONTAINER"] = container +#@ params["JEST_TIMEOUT"] = 90000 +name: #@ container +serial: true +plan: +- { put: docker-host, params: { acquire: true } } +- in_parallel: + - { get: repo, trigger: true } + - { get: pipeline-tasks } +- task: #@ container + attempts: 2 + timeout: 12m + tags: ["galoy-staging"] + config: + platform: linux + image_resource: #@ rust_task_image_config() + inputs: + - name: pipeline-tasks + - name: docker-host + - name: repo + path: #@ data.values.gh_repository + "-" + container + caches: + - path: cargo-home + - path: cargo-target-dir + params: #@ params + run: + path: pipeline-tasks/ci/vendor/tasks/test-on-docker-host.sh + ensure: + put: docker-host + params: + release: docker-host +on_failure: #@ slack_failure_notification() +#@ end + #@ def nodejs_integration_test(): name: test-integration serial: true @@ -145,7 +185,7 @@ plan: SSH_PUB_KEY: ((staging-ssh.ssh_public_key)) JEST_TIMEOUT: 90000 run: - path: pipeline-tasks/ci/vendor/tasks/test-integration.sh + path: pipeline-tasks/ci/vendor/tasks/chart-test-integration.sh on_failure: #@ slack_failure_notification() #@ end @@ -176,7 +216,7 @@ plan: SSH_PRIVATE_KEY: ((staging-ssh.ssh_private_key)) SSH_PUB_KEY: ((staging-ssh.ssh_public_key)) run: - path: pipeline-tasks/ci/vendor/tasks/test-integration.sh + path: pipeline-tasks/ci/vendor/tasks/chart-test-integration.sh on_failure: #@ slack_failure_notification() #@ end @@ -219,7 +259,7 @@ plan: outputs: - name: repo run: - path: pipeline-tasks/ci/vendor/tasks/prep-docker-build-env.sh + path: pipeline-tasks/ci/vendor/tasks/docker-prep-docker-build-env.sh - task: build privileged: true config: @@ -316,7 +356,7 @@ plan: BRANCH: #@ data.values.git_charts_branch CHARTS_SUBDIR: #@ data.values.gh_repository run: - path: pipeline-tasks/ci/vendor/tasks/bump-image-digest.sh + path: pipeline-tasks/ci/vendor/tasks/docker-bump-image-digest.sh - put: charts-repo-bot-branch params: repository: charts-repo @@ -335,10 +375,10 @@ plan: BOT_BRANCH: #@ data.values.git_charts_bot_branch CHARTS_SUBDIR: #@ data.values.gh_repository run: - path: pipeline-tasks/ci/vendor/tasks/open-charts-pr.sh + path: pipeline-tasks/ci/vendor/tasks/chart-open-charts-pr.sh #@ end -#@ def repo_resource(): +#@ def repo_resource(webhook = False): name: repo type: git source: @@ -347,6 +387,9 @@ source: uri: #@ data.values.git_uri branch: #@ data.values.git_branch private_key: #@ data.values.github_private_key +#@ if webhook: +webhook_token: ((webhook.secret)) +#@ end #@ end #@ def pipeline_tasks_resource(): @@ -369,7 +412,7 @@ source: repository: #@ public_docker_registry() + "/" + data.values.gh_repository #@ end -#@ def nodejs_deps_resource(): +#@ def nodejs_deps_resource(webhook = False): name: deps type: git source: @@ -377,6 +420,9 @@ source: uri: #@ data.values.git_uri branch: #@ data.values.git_branch private_key: #@ data.values.github_private_key +#@ if webhook: +webhook_token: ((webhook.secret)) +#@ end #@ end #@ def deps_version_resource(): @@ -454,6 +500,16 @@ source: private_key: #@ data.values.github_private_key #@ end +#@ def docker_host_pool(): +name: docker-host +type: pool +source: + uri: git@github.com:GaloyMoney/concourse-locks.git + branch: main + pool: docker-hosts + private_key: #@ data.values.github_private_key +#@ end + #@ def gcr_resource_type(): name: gcs-resource type: docker-image diff --git a/ci/vendor/rust-dependabot.yml b/ci/vendor/rust-dependabot.yml deleted file mode 100644 index 14527ca..0000000 --- a/ci/vendor/rust-dependabot.yml +++ /dev/null @@ -1,11 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: -- package-ecosystem: "cargo" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "daily" diff --git a/ci/vendor/tasks/open-charts-pr.sh b/ci/vendor/tasks/chart-open-charts-pr.sh similarity index 83% rename from ci/vendor/tasks/open-charts-pr.sh rename to ci/vendor/tasks/chart-open-charts-pr.sh index d6a4dd2..6acf1e0 100755 --- a/ci/vendor/tasks/open-charts-pr.sh +++ b/ci/vendor/tasks/chart-open-charts-pr.sh @@ -1,5 +1,8 @@ #!/bin/bash +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + set -eu export digest=$(cat ./edge-image/digest) diff --git a/ci/vendor/tasks/test-integration.sh b/ci/vendor/tasks/chart-test-integration.sh similarity index 85% rename from ci/vendor/tasks/test-integration.sh rename to ci/vendor/tasks/chart-test-integration.sh index e363d59..69e20cd 100755 --- a/ci/vendor/tasks/test-integration.sh +++ b/ci/vendor/tasks/chart-test-integration.sh @@ -1,5 +1,8 @@ #!/bin/bash +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + set -eu . pipeline-tasks/ci/vendor/tasks/helpers.sh @@ -36,7 +39,7 @@ rsync --delete --exclude target -avr -e "ssh -l ${DOCKER_HOST_USER} ${ADDITIONAL ./ ${DOCKER_HOST_IP}:${REPO_PATH} > /dev/null echo "Done!" -docker compose down --volumes --remove-orphans --timeout 1 +docker compose down --remove-orphans --timeout 1 ssh ${ADDITIONAL_SSH_OPTS} ${DOCKER_HOST_USER}@${DOCKER_HOST_IP} \ "cd ${REPO_PATH}; docker compose -f docker-compose.yml up integration-tests" @@ -44,6 +47,6 @@ ssh ${ADDITIONAL_SSH_OPTS} ${DOCKER_HOST_USER}@${DOCKER_HOST_IP} \ container_id=$(docker ps -q -f status=exited -f name="${PWD##*/}-integration-tests-") test_status=$(docker inspect $container_id --format='{{.State.ExitCode}}') -docker compose down --volumes --remove-orphans --timeout 1 +docker compose down --remove-orphans --timeout 1 exit $test_status diff --git a/ci/vendor/tasks/check-code.sh b/ci/vendor/tasks/check-code.sh deleted file mode 100755 index e04497c..0000000 --- a/ci/vendor/tasks/check-code.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -eu - -export REPO_PATH=repo - -. pipeline-tasks/ci/vendor/tasks/helpers.sh - -unpack_deps - -pushd repo - -make check-code diff --git a/ci/vendor/tasks/bump-image-digest.sh b/ci/vendor/tasks/docker-bump-image-digest.sh similarity index 85% rename from ci/vendor/tasks/bump-image-digest.sh rename to ci/vendor/tasks/docker-bump-image-digest.sh index dab4f13..f47ad52 100755 --- a/ci/vendor/tasks/bump-image-digest.sh +++ b/ci/vendor/tasks/docker-bump-image-digest.sh @@ -1,5 +1,8 @@ #!/bin/bash +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + set -eu export digest=$(cat ./edge-image/digest) diff --git a/ci/vendor/tasks/docker-prep-docker-build-env.sh b/ci/vendor/tasks/docker-prep-docker-build-env.sh new file mode 100755 index 0000000..9c0826b --- /dev/null +++ b/ci/vendor/tasks/docker-prep-docker-build-env.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + +if [[ -f version/version ]]; then + echo "VERSION=$(cat version/version)" >> repo/.env +fi + +echo "COMMITHASH=$(cat repo/.git/ref)" >> repo/.env +echo "BUILDTIME=$(date -u '+%F-%T')" >> repo/.env diff --git a/ci/vendor/tasks/helpers.sh b/ci/vendor/tasks/helpers.sh old mode 100644 new mode 100755 index 7ab9bff..2571ca7 --- a/ci/vendor/tasks/helpers.sh +++ b/ci/vendor/tasks/helpers.sh @@ -1,5 +1,14 @@ -export CARGO_HOME="$(pwd)/cargo-home" -export CARGO_TARGET_DIR="$(pwd)/cargo-target-dir" +#!/bin/bash + +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + +if [[ -z $(git config --global user.email) ]]; then + git config --global user.email "bot@galoy.io" +fi +if [[ -z $(git config --global user.name) ]]; then + git config --global user.name "CI Bot" +fi function unpack_deps() { REPO_PATH=${REPO_PATH:-repo} diff --git a/ci/vendor/tasks/nodejs-audit.sh b/ci/vendor/tasks/nodejs-audit.sh index c1f900e..7c2ad61 100755 --- a/ci/vendor/tasks/nodejs-audit.sh +++ b/ci/vendor/tasks/nodejs-audit.sh @@ -1,5 +1,8 @@ #!/bin/bash +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + set -eu REPO_ROOT=${REPO_ROOT:-./} diff --git a/ci/vendor/tasks/cache-yarn-deps.sh b/ci/vendor/tasks/nodejs-cache-yarn-deps.sh similarity index 61% rename from ci/vendor/tasks/cache-yarn-deps.sh rename to ci/vendor/tasks/nodejs-cache-yarn-deps.sh index acc7070..d0862bd 100755 --- a/ci/vendor/tasks/cache-yarn-deps.sh +++ b/ci/vendor/tasks/nodejs-cache-yarn-deps.sh @@ -1,5 +1,8 @@ #!/bin/bash +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + set -eu tar_out="$(pwd)/bundled-deps" diff --git a/ci/vendor/tasks/nodejs-check-code.sh b/ci/vendor/tasks/nodejs-check-code.sh new file mode 100755 index 0000000..9db530b --- /dev/null +++ b/ci/vendor/tasks/nodejs-check-code.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + +set -eu + +export REPO_PATH=repo + +. pipeline-tasks/ci/vendor/tasks/helpers.sh + +unpack_deps + +pushd repo + +make check-code diff --git a/ci/vendor/tasks/prep-docker-build-env.sh b/ci/vendor/tasks/prep-docker-build-env.sh deleted file mode 100755 index 1c2ec62..0000000 --- a/ci/vendor/tasks/prep-docker-build-env.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -echo "COMMITHASH=$(cat repo/.git/ref)" >> repo/.env -echo "BUILDTIME=$(date -u '+%F-%T')" >> repo/.env diff --git a/ci/vendor/tasks/prep-release-src.sh b/ci/vendor/tasks/prep-release-src.sh index 8624c81..1de0040 100755 --- a/ci/vendor/tasks/prep-release-src.sh +++ b/ci/vendor/tasks/prep-release-src.sh @@ -1,5 +1,8 @@ #!/bin/bash +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + set -eu # ------------ CHANGELOG ------------ diff --git a/ci/vendor/tasks/test-on-docker-host.sh b/ci/vendor/tasks/test-on-docker-host.sh new file mode 100755 index 0000000..1de6c7d --- /dev/null +++ b/ci/vendor/tasks/test-on-docker-host.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +set -eu + +export CI_ROOT=$(pwd) + +host_name=$(cat docker-host/metadata | jq -r '.docker_host_name') +echo "Running on host: ${host_name}" +host_zone=$(cat docker-host/metadata | jq -r '.docker_host_zone') +gcp_project=$(cat docker-host/metadata | jq -r '.docker_host_project') + +gcloud_ssh() { + gcloud compute ssh ${host_name} \ + --zone=${host_zone} \ + --project=${gcp_project} \ + --ssh-key-file=${CI_ROOT}/login.ssh \ + --tunnel-through-iap \ + --command "$@" 2> /dev/null +} + +cat < ${CI_ROOT}/gcloud-creds.json +${GOOGLE_CREDENTIALS} +EOF +cat < ${CI_ROOT}/login.ssh +${SSH_PRIVATE_KEY} +EOF +chmod 600 ${CI_ROOT}/login.ssh +cat < ${CI_ROOT}/login.ssh.pub +${SSH_PUB_KEY} +EOF +gcloud auth activate-service-account --key-file ${CI_ROOT}/gcloud-creds.json 2> /dev/null + +gcloud_ssh "docker ps -qa | xargs docker rm -fv || true; sudo rm -rf ${REPO_PATH}" + +pushd ${REPO_PATH} + +make create-tmp-env-ci || true + +gcloud compute scp --ssh-key-file=${CI_ROOT}/login.ssh \ + --recurse $(pwd) ${host_name}:${REPO_PATH} \ + --tunnel-through-iap \ + --zone=${host_zone} \ + --project=${gcp_project} > /dev/null + +gcloud_ssh "cd ${REPO_PATH}; export TMP_ENV_CI=tmp.env.ci; export COMPOSE_PROJECT_NAME=${REPO_PATH}; docker compose pull; docker compose -f docker-compose.yml up ${TEST_CONTAINER} --attach ${TEST_CONTAINER} 2>&1" + +container_id=$(gcloud_ssh "docker ps -q -f status=exited -f name=${PWD##*/}-${TEST_CONTAINER}-") +test_status=$(gcloud_ssh "docker inspect $container_id --format='{{.State.ExitCode}}'") + +gcloud_ssh "cd ${REPO_PATH}; docker compose down --remove-orphans --timeout 1" + +exit $test_status