Skip to content

Commit

Permalink
ci: add check whether containers exist to release workflows (#289)
Browse files Browse the repository at this point in the history
Issue #, if available:

*Description of changes:*

*Testing done:*

https://github.com/runfinch/finch/actions/runs/4474180786/jobs/7862373557

https://github.com/runfinch/finch/actions/runs/4473887998/jobs/7861762980


- [x] I've reviewed the guidance in CONTRIBUTING.md


#### License Acceptance

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

---------

Signed-off-by: Anqi Pang <[email protected]>
  • Loading branch information
AnqiPang authored Mar 21, 2023
1 parent b221ea0 commit 3df1317
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 20 deletions.
50 changes: 42 additions & 8 deletions .github/workflows/release-homebrew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ jobs:
FINCH_TAG: ${{ needs.get-latest-tag.outputs.tag }}
FINCH_VERSION: ${{ needs.get-latest-tag.outputs.version }}
steps:
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: true
- uses: actions/checkout@v3
with:
ref: ${{ env.FINCH_TAG }}
fetch-depth: 0
persist-credentials: false
submodules: true
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true
- name: Clean up previous files
run: |
sudo rm -rf /opt/finch
Expand Down Expand Up @@ -106,6 +106,23 @@ jobs:
finch pull alpine
./_output/bin/finch run --name test-ctr1 alpine
finch run --name test-ctr2 alpine
# check whether containers exist
if ! ./_output/bin/finch ps -a | grep 'test-ctr1'; then
echo "ERROR: The container test-ctr1 doesn't exist in the built finch VM"
exit 1
fi
if ./_output/bin/finch ps -a | grep 'test-ctr2'; then
echo "ERROR: The container test-ctr2 shoudn't exist in the built finch VM"
exit 1
fi
if ! finch ps -a | grep 'test-ctr2'; then
echo "ERROR: The container test-ctr2 doesn't exist in the installed finch VM"
exit 1
fi
if finch ps -a | grep 'test-ctr1'; then
echo "ERROR: The container test-ctr1 shoudn't exist in the installed finch VM"
exit 1
fi
# clean up the VMs
./_output/bin/finch vm stop && ./_output/bin/finch vm remove
finch vm stop && finch vm remove
Expand Down Expand Up @@ -148,16 +165,16 @@ jobs:
FINCH_TAG: ${{ needs.get-latest-tag.outputs.tag }}
FINCH_VERSION: ${{ needs.get-latest-tag.outputs.version }}
steps:
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: true
- uses: actions/checkout@v3
with:
ref: ${{ env.FINCH_TAG }}
fetch-depth: 0
persist-credentials: false
submodules: true
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true
- name: Clean up previous files
run: |
sudo rm -rf /opt/finch
Expand Down Expand Up @@ -200,6 +217,23 @@ jobs:
finch pull alpine
./_output/bin/finch run --name test-ctr1 alpine
finch run --name test-ctr2 alpine
# check whether containers exist
if ! ./_output/bin/finch ps -a | grep 'test-ctr1'; then
echo "ERROR: The container test-ctr1 doesn't exist in the built finch VM"
exit 1
fi
if ./_output/bin/finch ps -a | grep 'test-ctr2'; then
echo "ERROR: The container test-ctr2 shoudn't exist in the built finch VM"
exit 1
fi
if ! finch ps -a | grep 'test-ctr2'; then
echo "ERROR: The container test-ctr2 doesn't exist in the installed finch VM"
exit 1
fi
if finch ps -a | grep 'test-ctr1'; then
echo "ERROR: The container test-ctr1 shoudn't exist in the installed finch VM"
exit 1
fi
# clean up the VMs
./_output/bin/finch vm stop && ./_output/bin/finch vm remove
finch vm stop && finch vm remove
Expand Down
40 changes: 28 additions & 12 deletions .github/workflows/release-installer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ jobs:
env:
ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }}
steps:
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: true
- name: Checkout the tag
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
persist-credentials: false
submodules: true
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true
- name: Clean up previous files
run: |
sudo rm -rf /opt/finch
Expand Down Expand Up @@ -89,11 +89,19 @@ jobs:
finch run --name test-ctr2 alpine
# check whether containers exist
if ! ./_output/bin/finch ps -a | grep 'test-ctr1'; then
echo "ERROR: The container test-ctr1 doesn't exist"
echo "ERROR: The container test-ctr1 doesn't exist in the built finch VM"
exit 1
fi
if ./_output/bin/finch ps -a | grep 'test-ctr2'; then
echo "ERROR: The container test-ctr2 shoudn't exist in the built finch VM"
exit 1
fi
if ! finch ps -a | grep 'test-ctr2'; then
echo "ERROR: The container test-ctr2 doesn't exist"
echo "ERROR: The container test-ctr2 doesn't exist in the installed finch VM"
exit 1
fi
if finch ps -a | grep 'test-ctr1'; then
echo "ERROR: The container test-ctr1 shoudn't exist in the installed finch VM"
exit 1
fi
# clean up the VMs
Expand Down Expand Up @@ -129,17 +137,17 @@ jobs:
env:
ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }}
steps:
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: true
- name: Checkout the tag
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
persist-credentials: false
submodules: true
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true
- name: Clean up previous files
run: |
sudo rm -rf /opt/finch
Expand Down Expand Up @@ -180,11 +188,19 @@ jobs:
finch run --name test-ctr2 alpine
# check whether containers exist
if ! ./_output/bin/finch ps -a | grep 'test-ctr1'; then
echo "ERROR: The container test-ctr1 doesn't exist"
echo "ERROR: The container test-ctr1 doesn't exist in the built finch VM"
exit 1
fi
if ./_output/bin/finch ps -a | grep 'test-ctr2'; then
echo "ERROR: The container test-ctr2 shoudn't exist in the built finch VM"
exit 1
fi
if ! finch ps -a | grep 'test-ctr2'; then
echo "ERROR: The container test-ctr2 doesn't exist"
echo "ERROR: The container test-ctr2 doesn't exist in the installed finch VM"
exit 1
fi
if finch ps -a | grep 'test-ctr1'; then
echo "ERROR: The container test-ctr1 shoudn't exist in the installed finch VM"
exit 1
fi
# clean up the VMs
Expand Down

0 comments on commit 3df1317

Please sign in to comment.