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

ci(shared): bump vendored ci files #82

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 5 additions & 1 deletion .github/workflows/check-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
name: Check Code
runs-on: ubuntu-latest
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: actions/checkout@v3
- name: Run check code
run: make check-code
run: nix develop -c make check-code
6 changes: 5 additions & 1 deletion .github/workflows/vendor/rust-check-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
name: Check Code
runs-on: ubuntu-latest
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: actions/checkout@v3
- name: Run check code
run: make check-code
run: nix develop -c make check-code
10 changes: 5 additions & 5 deletions ci/vendir.lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ apiVersion: vendir.k14s.io/v1alpha1
directories:
- contents:
- git:
commitTitle: 'chore: add webhook config'
sha: 9d0f008e41df2f5d5e0461171c02fc0c4aee1d6f
commitTitle: 'fix: check-code executable'
sha: cfd07211efb7ef9c986020d1d24069c820fd1717
path: .
path: ../.github/workflows/vendor
- contents:
- git:
commitTitle: 'chore: add webhook config'
sha: 9d0f008e41df2f5d5e0461171c02fc0c4aee1d6f
commitTitle: 'fix: check-code executable'
sha: cfd07211efb7ef9c986020d1d24069c820fd1717
path: .
path: ./vendor
path: vendor
kind: LockConfig
4 changes: 2 additions & 2 deletions ci/vendir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ directories:
- path: . # Copy this folder out to ..
git:
url: https://github.com/GaloyMoney/concourse-shared.git
ref: 9d0f008e41df2f5d5e0461171c02fc0c4aee1d6f
ref: cfd07211efb7ef9c986020d1d24069c820fd1717
includePaths:
- shared/actions/*
excludePaths:
Expand All @@ -21,7 +21,7 @@ directories:
- path: .
git:
url: https://github.com/GaloyMoney/concourse-shared.git
ref: 9d0f008e41df2f5d5e0461171c02fc0c4aee1d6f
ref: cfd07211efb7ef9c986020d1d24069c820fd1717
includePaths:
- shared/ci/**/*
excludePaths:
Expand Down
55 changes: 46 additions & 9 deletions ci/vendor/pipeline-fragments.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#@ return "us.gcr.io/galoy-org"
#@ end

#@ def private_docker_registry():
#@ return "gcr.io/galoy-org"
#@ end

#@ def nodejs_concourse_image():
#@ return public_docker_registry() + "/nodejs-concourse"
#@ end
Expand Down Expand Up @@ -40,6 +44,12 @@ source:
repository: #@ release_concourse_image()
#@ end

#@ def nix_task_image_config():
type: registry-image
source:
repository: nixpkgs/nix-flakes
#@ end

#@ def slack_failure_notification():
#@ fail_url = "<$ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME| :face_with_symbols_on_mouth: $BUILD_JOB_NAME> failed!"
put: slack
Expand All @@ -50,6 +60,25 @@ params:
text: #@ fail_url
#@ end

#@ def check_code():
name: check-code
serial: true
plan:
- in_parallel:
- { get: repo, trigger: true }
- { get: pipeline-tasks }
- task: check-code
config:
platform: linux
image_resource: #@ nix_task_image_config()
inputs:
- name: pipeline-tasks
- name: repo
run:
path: pipeline-tasks/ci/vendor/tasks/check-code.sh
on_failure: #@ slack_failure_notification()
#@ end

#@ def nodejs_check_code():
name: check-code
serial: true
Expand Down Expand Up @@ -134,6 +163,7 @@ plan:
- { get: repo, trigger: true }
- { get: pipeline-tasks }
- task: #@ container
attempts: 2
timeout: 12m
tags: ["galoy-staging"]
config:
Expand Down Expand Up @@ -260,21 +290,27 @@ plan:
run:
path: pipeline-tasks/ci/vendor/tasks/docker-prep-docker-build-env.sh
- task: build
privileged: true
config:
platform: linux
image_resource:
type: registry-image
source:
repository: vito/oci-build-task
repository: gcr.io/kaniko-project/executor
tag: debug
inputs:
- name: repo
outputs:
- name: image
params:
CONTEXT: repo
run:
path: build
path: /kaniko/executor
args:
- --dockerfile=Dockerfile
- --context=repo
- --use-new-run
- --single-snapshot
- --cache=false
- --no-push
- --tar-path=image/image.tar
- put: edge-image
params:
image: image/image.tar
Expand Down Expand Up @@ -365,6 +401,7 @@ plan:
platform: linux
image_resource: #@ nodejs_task_image_config()
inputs:
- name: repo
- name: pipeline-tasks
- name: edge-image
- name: charts-repo
Expand Down Expand Up @@ -401,14 +438,14 @@ source:
private_key: #@ data.values.github_private_key
#@ end

#@ def edge_image_resource():
#@ def edge_image_resource(publicRepo = True):
name: edge-image
type: registry-image
source:
tag: edge
username: #@ data.values.docker_registry_user
password: #@ data.values.docker_registry_password
repository: #@ public_docker_registry() + "/" + data.values.gh_repository
repository: #@ public_docker_registry() + "/" + data.values.gh_repository if publicRepo else private_docker_registry() + "/" + data.values.gh_repository
#@ end

#@ def nodejs_deps_resource(webhook = False):
Expand Down Expand Up @@ -472,13 +509,13 @@ source:
private_key: #@ data.values.github_private_key
#@ end

#@ def versioned_image_resource():
#@ def versioned_image_resource(publicRepo = True):
name: versioned-image
type: registry-image
source:
username: #@ data.values.docker_registry_user
password: #@ data.values.docker_registry_password
repository: #@ public_docker_registry() + "/" + data.values.gh_repository
repository: #@ public_docker_registry() + "/" + data.values.gh_repository if publicRepo else private_docker_registry() + "/" + data.values.gh_repository
#@ end

#@ def gh_release_resource():
Expand Down
10 changes: 10 additions & 0 deletions ci/vendor/tasks/check-code.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/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

pushd repo

nix develop -c make check-code
4 changes: 3 additions & 1 deletion ci/vendor/tasks/docker-bump-image-digest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export app_version=$(cat version/version)
pushd charts-repo

yq -i e '.image.digest = strenv(digest)' ./charts/${CHARTS_SUBDIR}/values.yaml
yq -i e '.image.git_ref = strenv(ref)' ./charts/${CHARTS_SUBDIR}/values.yaml

sed -i "s|\(digest: \"${digest}\"\).*$|\1 # METADATA:: repository=https://github.com/GaloyMoney/${CHARTS_SUBDIR};commit_ref=${ref};app=${CHARTS_SUBDIR};|g" "./charts/${CHARTS_SUBDIR}/values.yaml"

yq -i e '.appVersion = strenv(app_version)' ./charts/${CHARTS_SUBDIR}/Chart.yaml

if [[ -z $(git config --global user.email) ]]; then
Expand Down
6 changes: 3 additions & 3 deletions ci/vendor/tasks/test-on-docker-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ${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}"
gcloud_ssh "docker ps -qa | xargs docker rm -fv || true; sudo rm -rf ${REPO_PATH} || true; mkdir -p ${REPO_PATH} && cd ${REPO_PATH}/../ && rmdir $(basename ${REPO_PATH})"

pushd ${REPO_PATH}

Expand All @@ -42,11 +42,11 @@ gcloud compute scp --ssh-key-file=${CI_ROOT}/login.ssh \
--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}"
gcloud_ssh "cd ${REPO_PATH}; export TMP_ENV_CI=tmp.env.ci; export COMPOSE_PROJECT_NAME=$(basename ${REPO_PATH}); source .envrc || true; 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"
gcloud_ssh "cd ${REPO_PATH}; export COMPOSE_PROJECT_NAME=$(basename ${REPO_PATH}); docker compose down --remove-orphans --timeout 1"

exit $test_status
Loading