make release idempotent (#2278)

This commit is contained in:
Adrian Stobbe 2023-08-28 09:21:25 +02:00 committed by GitHub
parent a671367794
commit 7c9a78fe51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 23 deletions

View File

@ -27,6 +27,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0 # fetch all history
- name: Determine branch names
run: |
@ -35,20 +37,8 @@ jobs:
PART_MINOR=${WITHOUT_V#*.}
MAJOR_MINOR=${PART_MAJOR}.${PART_MINOR}
RELEASE_BRANCH="release/v${MAJOR_MINOR}"
WORKING_BRANCH_PREFIX="origin/tmp/${FULL_VERSION}"
WORKING_BRANCH="tmp/${FULL_VERSION}"
echo "RELEASE_BRANCH=${RELEASE_BRANCH}" | tee -a "$GITHUB_ENV"
echo "WORKING_BRANCH_PREFIX=${WORKING_BRANCH_PREFIX}" | tee -a "$GITHUB_ENV"
- name: Find temporary branch
id: find-temporary-branch
run: |
working_branch_count=$(git branch --list -r "${WORKING_BRANCH_PREFIX}*" | wc -l)
if [[ "${working_branch_count}" -ne 1 ]]; then
echo "More than one (or zero) temporary branches found. Cannot finish transaction."
git branch --list "${WORKING_BRANCH_PREFIX}*"
exit 1
fi
WORKING_BRANCH=$(git branch --list "${WORKING_BRANCH_PREFIX}*" | head -n 1 | sed -e 's/^[[:space:]]*//')
echo "WORKING_BRANCH=${WORKING_BRANCH}" | tee -a "$GITHUB_ENV"
- name: Check if we are strictly ahead of the release branch (if it exists)

View File

@ -13,6 +13,9 @@ on:
required: true
default: "minor"
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
verify-inputs:
name: Verify inputs
@ -44,8 +47,8 @@ jobs:
- name: Verify temporary branch
run: |
if [[ ! "${WORKING_BRANCH}" =~ ^tmp/v[0-9]+\.[0-9]+\.[0-9]+(/.+)? ]]; then
echo "Workflow can only be triggered from a temporary branch in the form of tmp/vX.Y.Z/..."
if [[ ! "${WORKING_BRANCH}" =~ ^tmp/v[0-9]+\.[0-9]+\.[0-9] ]]; then
echo "Workflow can only be triggered from a temporary branch in the form of tmp/vX.Y.Z"
exit 1
fi
@ -176,8 +179,12 @@ jobs:
run: |
git config --global user.name "edgelessci"
git config --global user.email "edgelessci@users.noreply.github.com"
if git diff-index --quiet HEAD --; then
echo "No changes to commit"
else
git commit -m "deps: update images to ${VERSION}"
git push
fi
os-image:
name: Build OS image
@ -251,7 +258,7 @@ jobs:
git config --global user.name "edgelessci"
git config --global user.email "edgelessci@users.noreply.github.com"
git tag -a "${VERSION}" -m "Release ${VERSION}"
git push origin "refs/tags/${VERSION}"
git push --force origin "refs/tags/${VERSION}" # force push to overwrite existing tag
draft-release-cli:
name: Draft release (CLI)

View File

@ -79,11 +79,8 @@ Then wait until the node / Kubernetes upgrades are finished by periodically chec
4. Update the `fromVersion` in `e2e-test-release.yml` and `e2e-test-weekly.yaml` to the newly released version. To check the current values, run: `grep "fromVersion: \[.*\]" -R .github`.
5. Reset `upgradeRequiresIAMMigration` in `iamupgradeapply.go`.
## Pipeline cleanup
When testing changes to the pipeline or when the pipeline fails during a release it might become necessary to clean up the images created by the pipeline.
These are the necessary steps.
## Troubleshooting: Pipeline cleanup
No manual steps should be necessary anymore but in case you encounter issues, create a ticket to fix it. These are instructions to do some cleanup steps manually:
### General
Depending on how far the pipeline ran we need to delete: