mirror of
https://github.com/balena-io/open-balena.git
synced 2024-12-24 15:56:39 +00:00
Merge pull request #273 from balena-io/ab77/patch
Only delete your (matrix) own test instance
This commit is contained in:
commit
9fde727b80
30
.github/workflows/tests.yml
vendored
30
.github/workflows/tests.yml
vendored
@ -1011,7 +1011,7 @@ jobs:
|
|||||||
|
|
||||||
# always destroy test EC2 instances even if the workflow is cancelled
|
# always destroy test EC2 instances even if the workflow is cancelled
|
||||||
- name: destroy AWS test device(s)
|
- name: destroy AWS test device(s)
|
||||||
if: always()
|
if: always() && matrix.target == 'balena-public-pki'
|
||||||
run: |
|
run: |
|
||||||
set -ue
|
set -ue
|
||||||
|
|
||||||
@ -1024,14 +1024,36 @@ jobs:
|
|||||||
--instance-ids ${{ steps.balena-sut.outputs.instance_id }}
|
--instance-ids ${{ steps.balena-sut.outputs.instance_id }}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
env:
|
||||||
|
AWS_DEFAULT_REGION: ${{ vars.AWS_REGION || 'us-east-1' }}
|
||||||
|
|
||||||
|
# always destroy test EC2 instances even if the workflow is cancelled
|
||||||
|
- name: destroy AWS test device(s)
|
||||||
|
if: always() && matrix.target == 'compose-private-pki'
|
||||||
|
run: |
|
||||||
|
set -ue
|
||||||
|
|
||||||
|
[[ '${{ vars.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
|
||||||
|
|
||||||
|
source src/balena-tests/functions
|
||||||
|
|
||||||
if [[ -n '${{ steps.ubuntu-sut.outputs.instance_id }}' ]]; then
|
if [[ -n '${{ steps.ubuntu-sut.outputs.instance_id }}' ]]; then
|
||||||
with_backoff aws ec2 terminate-instances \
|
with_backoff aws ec2 terminate-instances \
|
||||||
--instance-ids ${{ steps.ubuntu-sut.outputs.instance_id }}
|
--instance-ids ${{ steps.ubuntu-sut.outputs.instance_id }}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
with_backoff aws ec2 describe-instances --filters Name=tag:GITHUB_SHA,Values=${GITHUB_SHA}-tests \
|
env:
|
||||||
| jq -r .Reservations[].Instances[].InstanceId \
|
AWS_DEFAULT_REGION: ${{ vars.AWS_REGION || 'us-east-1' }}
|
||||||
| xargs --no-run-if-empty aws ec2 terminate-instances --instance-ids
|
|
||||||
|
# always destroy stale test EC2 instances
|
||||||
|
- name: destroy stale AWS test device(s)
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
set -ue
|
||||||
|
|
||||||
|
[[ '${{ vars.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
|
||||||
|
|
||||||
|
source src/balena-tests/functions
|
||||||
|
|
||||||
stale_instances=$(mktemp)
|
stale_instances=$(mktemp)
|
||||||
aws ec2 describe-instances --filters \
|
aws ec2 describe-instances --filters \
|
||||||
|
Loading…
Reference in New Issue
Block a user