From 295ed47c43b8ce926aea64d7919d25971cf72d61 Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Thu, 8 Apr 2021 07:10:44 -0400 Subject: [PATCH] Add GHA workflow for pushing releases to Quay --- .github/workflows/devel.yaml | 34 ++++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 11 ++++++----- README.md | 36 +++++++++++++++++++--------------- 3 files changed, 60 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/devel.yaml diff --git a/.github/workflows/devel.yaml b/.github/workflows/devel.yaml new file mode 100644 index 00000000..81a109db --- /dev/null +++ b/.github/workflows/devel.yaml @@ -0,0 +1,34 @@ +--- + +name: Devel + +on: + push: + branches: [devel] + +jobs: + release: + runs-on: ubuntu-18.04 + name: Push devel image + steps: + - uses: actions/checkout@v2 + + - name: Install Operator-SDK + run: | + mkdir -p $GITHUB_WORKSPACE/bin + wget -O $GITHUB_WORKSPACE/bin/operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/v0.19.4/operator-sdk-v0.19.4-x86_64-linux-gnu + chmod +x $GITHUB_WORKSPACE/bin/operator-sdk + echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH + + - name: Build Image + run: | + operator-sdk build awx-operator:devel + + - name: Push To Quay + uses: redhat-actions/push-to-registry@v2.1.1 + with: + image: awx-operator + tags: devel + registry: quay.io/ansible/ + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8edeefa8..46916a01 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,13 +3,14 @@ name: Release on: - push: - branches: [devel] + release: + types: + - created jobs: release: runs-on: ubuntu-18.04 - name: release + name: Push tagged image to Quay steps: - uses: actions/checkout@v2 @@ -22,13 +23,13 @@ jobs: - name: Build Image run: | - operator-sdk build awx-operator:devel + operator-sdk build awx-operator:${{ github.event.release.tag_name }} - name: Push To Quay uses: redhat-actions/push-to-registry@v2.1.1 with: image: awx-operator - tags: devel + tags: ${{ github.event.release.tag_name }} registry: quay.io/ansible/ username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_TOKEN }} diff --git a/README.md b/README.md index 3db75e76..1ff18e97 100644 --- a/README.md +++ b/README.md @@ -502,21 +502,34 @@ There are a few moving parts to this project: Each of these must be appropriately built in preparation for a new tag: -### Build a new release +### Verify Functionality Run the following command inside this directory: ```sh -#> operator-sdk build quay.io/ansible/awx-operator:$VERSION +#> operator-sdk build quay.io//awx-operator:test ``` Then push the generated image to Docker Hub: ```sh -#> docker push quay.io/ansible/awx-operator:$VERSION +#> docker push quay.io//awx-operator:test ``` -### Build a new version of the operator yaml file +After it is built, test it on a local cluster: + + +```sh +#> minikube start --memory 6g --cpus 4 +#> minikube addons enable ingress +#> ansible-playbook ansible/deploy-operator.yml -e operator_image=quay.io//awx-operator -e operator_version=test +#> kubectl create namespace example-awx +#> ansible-playbook ansible/instantiate-awx-deployment.yml -e tower_namespace=example-awx +#> +#> minikube delete +``` + +### Update version Update the awx-operator version: @@ -528,20 +541,11 @@ Once the version has been updated, run from the root of the repo: #> ansible-playbook ansible/chain-operator-files.yml ``` -After it is built, test it on a local cluster: +### Commit / Create Release +If everything works, commit the updated version, then [publish a new release](https://github.com/ansible/awx-operator/releases/new) using the same version you used in `ansible/group_vars/all`. -```sh -#> minikube start --memory 6g --cpus 4 -#> minikube addons enable ingress -#> ansible-playbook ansible/deploy-operator.yml -#> kubectl create namespace example-awx -#> ansible-playbook ansible/instantiate-awx-deployment.yml -e tower_namespace=example-awx -#> -#> minikube delete -``` - -If everything works, commit the updated version, then tag a new repository release with the same tag as the Docker image pushed earlier. +After creating the release, [this GitHub Workflow](https://github.com/ansible/awx-operator/blob/devel/.github/workflows/release.yaml) will run and publish the new image to quay.io. ## Author