summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorShane McDonald <me@shanemcd.com>2021-11-19 03:22:45 +0100
committerShane McDonald <me@shanemcd.com>2021-11-19 03:22:45 +0100
commitef1563283ecc121d016bfc52f8c2adf4581b75d2 (patch)
tree82eb3bc6fc89e303a40f78f058f16259c305750c /.github
parentMerge pull request #11368 from shanemcd/downstream-changes (diff)
downloadawx-ef1563283ecc121d016bfc52f8c2adf4581b75d2.tar.xz
awx-ef1563283ecc121d016bfc52f8c2adf4581b75d2.zip
An automated stage / promotion release process
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/promote.yml26
-rw-r--r--.github/workflows/release.yml56
-rw-r--r--.github/workflows/stage.yml123
3 files changed, 149 insertions, 56 deletions
diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml
new file mode 100644
index 0000000000..3955d7fcd7
--- /dev/null
+++ b/.github/workflows/promote.yml
@@ -0,0 +1,26 @@
+---
+name: Promote Release
+on:
+ release:
+ types: [published]
+
+jobs:
+ promote:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Log in to GHCR
+ run: |
+ echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
+
+ - name: Log in to Quay
+ run: |
+ echo ${{ secrets.QUAY_TOKEN }} | docker login quay.io -u ${{ secrets.QUAY_USER }} --password-stdin
+
+ - name: Re-tag and promote awx image
+ run: |
+ docker pull ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
+ docker tag ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} quay.io/${{ github.repository }}:${{ github.event.release.tag_name }}
+ docker tag ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} quay.io/${{ github.repository }}:latest
+ docker push quay.io/${{ github.repository }}:${{ github.event.release.tag_name }}
+ docker push quay.io/${{ github.repository }}:latest
+
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
deleted file mode 100644
index 3bd98066d8..0000000000
--- a/.github/workflows/release.yml
+++ /dev/null
@@ -1,56 +0,0 @@
-name: Release AWX
-on:
- workflow_dispatch:
- inputs:
- version:
- description: 'Version'
- required: true
- default: ''
- confirm:
- description: 'Are you sure? Set this to yes.'
- required: true
- default: 'no'
-
-jobs:
- release:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
-
- - name: "Verify inputs"
- run: |
- set -e
-
- if [[ ${{ github.event.inputs.confirm }} != "yes" ]]; then
- >&2 echo "Confirm must be 'yes'"
- exit 1
- fi
-
- if [[ ${{ github.event.inputs.version }} == "" ]]; then
- >&2 echo "Set version to continue."
- exit 1
- fi
-
- exit 0
-
- - name: Generate changelog
- uses: shanemcd/simple-changelog-generator@v1
- id: changelog
- with:
- repo: "${{ github.repository }}"
-
- - name: Write changelog to file
- run: |
- cat << 'EOF' > /tmp/changelog
- ${{ steps.changelog.outputs.changelog }}
- EOF
-
- - name: Release AWX
- run: |
- ansible-playbook -v tools/ansible/release.yml \
- -e changelog_path=/tmp/changelog \
- -e version=${{ github.event.inputs.version }} \
- -e github_token=${{ secrets.GITHUB_TOKEN }} \
- -e repo=${{ github.repository }}
-
-
diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml
new file mode 100644
index 0000000000..58baef5b96
--- /dev/null
+++ b/.github/workflows/stage.yml
@@ -0,0 +1,123 @@
+---
+name: Stage Release
+on:
+ workflow_dispatch:
+ inputs:
+ version:
+ description: 'AWX version.'
+ required: true
+ default: ''
+ operator_version:
+ description: 'Operator version. Leave blank to skip staging awx-operator.'
+ default: ''
+ confirm:
+ description: 'Are you sure? Set this to yes.'
+ required: true
+ default: 'no'
+
+jobs:
+ stage:
+ runs-on: ubuntu-latest
+ permissions:
+ packages: write
+ contents: write
+ steps:
+ - name: Verify inputs
+ run: |
+ set -e
+
+ if [[ ${{ github.event.inputs.confirm }} != "yes" ]]; then
+ >&2 echo "Confirm must be 'yes'"
+ exit 1
+ fi
+
+ if [[ ${{ github.event.inputs.version }} == "" ]]; then
+ >&2 echo "Set version to continue."
+ exit 1
+ fi
+
+ exit 0
+
+ - name: Checkout awx
+ uses: actions/checkout@v2
+ with:
+ path: awx
+
+ - name: Checkout awx-logos
+ uses: actions/checkout@v2
+ with:
+ repository: ansible/awx-logos
+ path: awx-logos
+
+ - name: Checkout awx-operator
+ uses: actions/checkout@v2
+ with:
+ repository: ${{ github.repository_owner }}/awx-operator
+ path: awx-operator
+
+ - name: Install playbook dependencies
+ run: |
+ python3 -m pip install docker
+
+ - name: Build and stage AWX
+ working-directory: awx
+ run: |
+ ansible-playbook -v tools/ansible/build.yml \
+ -e registry=ghcr.io \
+ -e registry_username=${{ github.actor }} \
+ -e registry_password=${{ secrets.GITHUB_TOKEN }} \
+ -e awx_image=${{ github.repository }} \
+ -e awx_version=${{ github.event.inputs.version }} \
+ -e ansible_python_interpreter=$(which python3) \
+ -e push=yes \
+ -e awx_official=yes
+
+ - name: Build and stage awx-operator
+ working-directory: awx-operator
+ run: |
+ BUILD_ARGS="--build-arg DEFAULT_AWX_VERSION=${{ github.event.inputs.version }}" \
+ IMAGE_TAG_BASE=ghcr.io/${{ github.repository_owner }}/awx-operator \
+ VERSION=${{ github.event.inputs.operator_version }} make docker-build docker-push
+
+ - name: Run test deployment with awx-operator
+ working-directory: awx-operator
+ run: |
+ python3 -m pip install -r molecule/requirements.txt
+ ansible-galaxy collection install -r molecule/requirements.yml
+ sudo rm -f $(which kustomize)
+ make kustomize
+ KUSTOMIZE_PATH=$(readlink -f bin/kustomize) molecule test -s kind
+ env:
+ AWX_TEST_IMAGE: ${{ github.repository }}
+ AWX_TEST_VERSION: ${{ github.event.inputs.version }}
+
+ - name: Generate changelog
+ uses: shanemcd/simple-changelog-generator@v1
+ id: changelog
+ with:
+ repo: "${{ github.repository }}"
+
+ - name: Write changelog to file
+ run: |
+ cat << 'EOF' > /tmp/awx-changelog
+ ${{ steps.changelog.outputs.changelog }}
+ EOF
+
+ - name: Create draft release for AWX
+ working-directory: awx
+ run: |
+ ansible-playbook -v tools/ansible/stage.yml \
+ -e changelog_path=/tmp/awx-changelog \
+ -e repo=${{ github.repository }} \
+ -e awx_image=ghcr.io/${{ github.repository }} \
+ -e version=${{ github.event.inputs.version }} \
+ -e github_token=${{ secrets.GITHUB_TOKEN }}
+
+ - name: Create draft release for awx-operator
+ if: ${{ github.event.inputs.operator_version != '' }}
+ working-directory: awx
+ run: |
+ ansible-playbook tools/ansible/stage.yml \
+ -e version=${{ github.event.inputs.operator_version }} \
+ -e repo=${{ github.repository_owner }}/awx-operator \
+ -e github_token=${{ secrets.AWX_OPERATOR_RELEASE_TOKEN }}