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

update tenzin when a new INT release is pushed #1447

Merged
merged 2 commits into from
Oct 14, 2024
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
42 changes: 41 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ jobs:
- run: echo "All tests pass!"
deploy:
runs-on: "ubuntu-22.04"
outputs:
build_version: ${{ steps.deploy.outputs.build_version }}
build_type: ${{ steps.deploy.outputs.build_type }}
needs: [all-pr-checks]
# see on.push.branches for which branches are built on push
if: github.event_name == 'push' && github.repository == 'threatgrid/ctia'
Expand Down Expand Up @@ -431,8 +434,45 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- run: ./build/deploy-actions.sh
- id: deploy
run: ./build/deploy-actions.sh
env:
# offline to catch issues where `lein warm-ci-deps` doesn't download all
# dependencies we need to deploy.
LEIN_OFFLINE: true

update-tenzin:
runs-on: ubuntu-22.04
needs: deploy
if: ${{ needs.deploy.outputs.build_type == 'int' }}
steps:
- name: Setup Git user
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions Bot"
- name: Checkout tenzin
uses: actions/checkout@v3
with:
repository: advthreat/tenzin
ssh-key: ${{ secrets.TENZIN_PRIVATE_SSH }}
path: tenzin
ref: master
- name: update ctia image tag
env:
BUILD_VERSION: ctia-${{ needs.deploy.outputs.build_version }}
run: |
cd tenzin/applications/ctia/kustomize/overlays/ctr-int-eks
yq -i '.images[0].newTag = env(BUILD_VERSION)' kustomization.yaml
git add kustomization.yaml
- name: Commit and push changes if any
env:
BUILD_VERSION: ctia-${{ needs.deploy.outputs.build_version }}
run: |
cd tenzin
if ! git diff --cached --quiet
then
git commit -m "Update ctia image tag to ${BUILD_VERSION}"
git push
else
echo "No changes to commit"
fi
3 changes: 3 additions & 0 deletions build/deploy-actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ EOF
docker tag "$docker_registry/$docker_nomad_repository:$build_version" "$prod_apjc_registry/$prod_nomad_repository:$build_version"
docker push "$prod_apjc_registry/$prod_nomad_repository:$build_version"
fi

echo "build_version=$build_version" >> "$GITHUB_OUTPUT"
echo "build_type=$build_type" >> "$GITHUB_OUTPUT"
}

function build-and-publish-package {
Expand Down
Loading