-
Notifications
You must be signed in to change notification settings - Fork 68
A0-1459: Replace triggering workflow from indexer repo with kubectl cmds #813
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
Merged
2 commits merged into
benjamin
from
A0-1459-replace-triggering-indexer-workflow-with-kubectl-cmds
Jan 5, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -303,23 +303,57 @@ jobs: | |
| - name: Cleanup cache | ||
| uses: ./.github/actions/post-cache | ||
|
|
||
| - name: Trigger Indexer deployment workflow | ||
| run: | | ||
| curl -X POST 'https://api.github.com/repos/Cardinal-Cryptography/indexer/actions/workflows/build-and-deploy-to-devnet.yml/dispatches' \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H 'Authorization: Bearer ${{ secrets.CI_GH_TOKEN }}' \ | ||
| -d '{ "ref":"master" }' | ||
| - name: GIT | Checkout aleph-apps repo | ||
| uses: actions/checkout@master | ||
| with: | ||
| repository: Cardinal-Cryptography/aleph-apps | ||
| token: ${{ secrets.CI_GH_TOKEN }} | ||
| path: "aleph-apps" | ||
| ref: main | ||
|
|
||
| - name: KUSTOMIZE | Init kustomize | ||
| uses: imranismail/setup-kustomize@v1 | ||
| with: | ||
| kustomize-version: '3.8.6' | ||
|
|
||
| - name: Setup kubectl | ||
| - name: KUBECTL | Setup kubectl | ||
| uses: azure/[email protected] | ||
| with: | ||
| version: 'v1.23.6' | ||
|
|
||
| - name: Restart the-button deployment | ||
| - name: INDEXER | Destroy archive and squid apps | ||
| shell: bash | ||
| run: | | ||
| aws eks --region eu-central-1 update-kubeconfig --name alephzero-devnet-eu-central-1-eks | ||
| kubectl delete -n indexer-squid --ignore-not-found=true deploy squid-api | ||
| kubectl delete -n indexer-squid --ignore-not-found=true deploy squid-processor | ||
| kubectl delete -n indexer-archive --ignore-not-found=true deploy archive-gateway | ||
| kubectl delete -n indexer-archive --ignore-not-found=true deploy archive-ingest | ||
|
|
||
| - name: INDEXER | Create archive db and archive apps | ||
| shell: bash | ||
| run: | | ||
| kubectl rollout restart statefulset archive-db -n indexer-archive | ||
| kubectl rollout status --watch --timeout=600s -n indexer-archive statefulset/archive-db | ||
| cd aleph-apps/indexer/archive/overlays/devnet/eu-central-1 | ||
| kustomize build . | kubectl apply -f - | ||
| sleep 3 | ||
| kubectl rollout status --watch --timeout=600s -n indexer-archive deploy/archive-ingest | ||
| kubectl rollout status --watch --timeout=600s -n indexer-archive deploy/archive-gateway | ||
|
|
||
| - name: INDEXER | Create squid db and squid apps | ||
| shell: bash | ||
| run: | | ||
| kubectl rollout restart statefulset squid-db -n indexer-squid | ||
| kubectl rollout status --watch --timeout=600s -n indexer-squid statefulset/squid-db | ||
| cd aleph-apps/indexer/squid/overlays/devnet/eu-central-1 | ||
| kustomize build . | kubectl apply -f - | ||
| sleep 3 | ||
| kubectl rollout status --watch --timeout=600s -n indexer-squid deploy/squid-processor | ||
| kubectl rollout status --watch --timeout=600s -n indexer-squid deploy/squid-api | ||
|
|
||
| - name: BUTTON | Restart the-button deployment | ||
| shell: bash | ||
| run: | | ||
| kubectl rollout restart deployment the-button -n the-button | ||
| kubectl rollout status --watch --timeout=600s -n the-button deploy/the-button | ||
|
|
||
| # TODO : Here the workflow should wait for a hook that notifies this workflow when the two prior steps have been finished succesfully | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I correct in thinking that these steps will be run on every push to the branch? Could we add a condition that the changes should touch the
contracts/directory to trigger the deployment?There was also a condition that checks the hash of the addresses.json file with the last deployed one (stored in S3) - is that gone now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both checking hash of the addresses.json file and downloading addresses.json from S3 bucket are now done by init containers that execute before database or app starts. We don't want these to be part of the deployment workflows in the indexer or the-button repositories. The steps here that re-deploy archive and squid are basically steps that were earlier in the indexer repository's workflow.
As for the triggering this workflow. There was a
pathssetting set tocontractsbut it was removed on yapee's request.If we really need to make it run only when
contracts/**have changed we could check adding an action with few conditions, like: https://github.com/marketplace/actions/has-changed-path or https://github.com/dorny/paths-filter ...