-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Release Workflow and Single Command Install artifact (#159)
- Add a make target to generate a single yaml file to apply for install - This will make it possible for users to install the operator by applying yaml for a particular version without cloning the repo. - Add Table of Contents to README.md - Add GHA to stage the release before publishing - push the stage operator image to ghcr.io, to be used by the promote workflow later - Build multi-arch images when releasing - Push the latest tag as well Signed-off-by: Christian M. Adams <[email protected]> Co-authored-by: Jon <[email protected]> Co-authored-by: Dimitri Savineau <[email protected]>
- Loading branch information
1 parent
8e0a669
commit 7992cf0
Showing
8 changed files
with
312 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Promote Operator Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
tag_name: | ||
description: 'Name for the tag of the release.' | ||
required: true | ||
quay_registry: | ||
description: 'Quay registry to push to.' | ||
default: 'quay.io/ansible' | ||
|
||
jobs: | ||
promote-staged-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set TAG_NAME for workflow_dispatch event | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
run: | | ||
echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV | ||
echo "QUAY_REGISTRY=${{ github.event.inputs.quay_registry }}" >> $GITHUB_ENV | ||
- name: Set TAG_NAME for release event | ||
if: ${{ github.event_name == 'release' }} | ||
run: | | ||
echo "TAG_NAME=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | ||
echo "QUAY_REGISTRY=quay.io/ansible" >> $GITHUB_ENV | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: 'main' | ||
depth: 0 | ||
path: eda-server-operator | ||
|
||
- name: Log into registry ghcr.io | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
- name: Log into registry quay.io | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USER }} | ||
password: ${{ secrets.QUAY_TOKEN }} | ||
|
||
- name: Pull Stored Image and Publish eda-server-operator:${TAG_NAME} | ||
run: | | ||
docker buildx imagetools create \ | ||
ghcr.io/${{ github.repository }}:${TAG_NAME} \ | ||
--tag ${QUAY_REGISTRY}/eda-server-operator:${TAG_NAME} \ | ||
--tag ${QUAY_REGISTRY}/eda-server-operator:latest | ||
working-directory: eda-server-operator | ||
|
||
- name: Pull Stored Image and Publish eda-server-operator:latest | ||
run: | | ||
docker buildx imagetools create \ | ||
ghcr.io/${{ github.repository }}:${TAG_NAME} \ | ||
--tag ${QUAY_REGISTRY}/eda-server-operator:latest | ||
working-directory: eda-server-operator | ||
|
||
- name: Build Bundle Image | ||
run: | | ||
make bundle bundle-build IMG=eda-server-operator:${TAG_NAME} VERSION=${TAG_NAME} BUNDLE_IMG=eda-server-operator-bundle:${TAG_NAME} | ||
docker tag eda-server-operator-bundle:${TAG_NAME} eda-server-operator-bundle:latest | ||
working-directory: eda-server-operator | ||
|
||
- name: Push Bundle Image | ||
uses: redhat-actions/[email protected] | ||
with: | ||
image: eda-server-operator-bundle | ||
tags: ${{ env.TAG_NAME }} latest | ||
registry: quay.io/ansible/ | ||
username: ${{ secrets.QUAY_USER }} | ||
password: ${{ secrets.QUAY_TOKEN }} | ||
|
||
- name: Build Catalog Image | ||
run: | | ||
make catalog-build CATALOG_IMG=eda-server-operator-catalog:${TAG_NAME} BUNDLE_IMG=quay.io/ansible/eda-server-operator-bundle:${TAG_NAME} | ||
docker tag eda-server-operator-catalog:${TAG_NAME} eda-server-operator-catalog:latest | ||
working-directory: eda-server-operator | ||
|
||
- name: Push Catalog Image | ||
uses: redhat-actions/[email protected] | ||
with: | ||
image: eda-server-operator-catalog | ||
tags: ${{ env.TAG_NAME }} latest | ||
registry: quay.io/ansible/ | ||
username: ${{ secrets.QUAY_USER }} | ||
password: ${{ secrets.QUAY_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
--- | ||
name: Stage Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to stage' | ||
required: true | ||
default_eda_version: | ||
description: 'Will be injected as the DEFAULT_EDA_VERSION build arg.' | ||
required: true | ||
default_eda_ui_version: | ||
description: 'Will be injected as the DEFAULT_EDA_UI_VERSION build arg.' | ||
required: true | ||
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 eda-server-operator | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ github.repository_owner }}/eda-server-operator | ||
path: eda-server-operator | ||
|
||
- name: Install playbook dependencies | ||
run: | | ||
python3 -m pip install docker | ||
- name: Log into registry ghcr.io | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build Operator Image | ||
run: | | ||
BUILD_ARGS="--build-arg DEFAULT_EDA_VERSION=${{ github.event.inputs.default_eda_version }} \ | ||
--build-arg DEFAULT_EDA_UI_VERSION=${{ github.event.inputs.default_eda_ui_version }} \ | ||
--build-arg OPERATOR_VERSION=${{ github.event.inputs.version }}" \ | ||
IMG=ghcr.io/${{ github.repository }}:${{ github.event.inputs.version }} \ | ||
make docker-buildx | ||
working-directory: eda-server-operator | ||
|
||
# Stub task for later PR to add EDA CI run | ||
# - name: Run test deployment | ||
# working-directory: eda-server-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: | ||
# EDA_TEST_VERSION: ${{ github.event.inputs.default_eda_version }} | ||
|
||
- name: Generate operator.yaml | ||
run: make generate-operator-yaml VERSION=${{ github.event.inputs.version }} | ||
working-directory: eda-server-operator | ||
|
||
|
||
- name: Create Draft Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.event.inputs.version }} | ||
release_name: Release ${{ github.event.inputs.version }} | ||
draft: true | ||
|
||
- name: Upload Release Artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./eda-server-operator/operator.yaml | ||
asset_name: operator.yaml | ||
asset_content_type: application/yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# EDA Server Operator Release Guide | ||
|
||
This document provides step-by-step instructions for releasing a new version of the EDA Server Operator. It includes tagging a new release, building and pushing images, and updating release artifacts. | ||
|
||
## Release Workflow | ||
|
||
### 1. Trigger the Release GitHub Action | ||
|
||
The release process is automated through a GitHub Action (GHA) workflow. You can trigger this workflow manually via the GitHub UI. | ||
|
||
- Navigate to the 'Actions' tab in the GitHub repository. | ||
- Select the 'Stage Release' workflow. | ||
- Click on 'Run workflow' dropdown. | ||
- Enter the new version number (e.g., `1.2.3`) in the 'Release Version' input box. | ||
- Click 'Run workflow'. | ||
|
||
### 2. Monitor the Workflow | ||
|
||
- Monitor the workflow for completion. | ||
- The workflow will handle: | ||
- Tagging the release. | ||
- Building and pushing operator image for multiple platforms. | ||
- Generating the `operator.yaml` file. | ||
- Creating a draft release and attaching the `operator.yaml` as an artifact. | ||
|
||
### 3. Publish the Release | ||
|
||
Once the draft release is created, you need to publish it: | ||
|
||
- Go to the 'Releases' section in the GitHub repository. | ||
- Open the draft release created by the GitHub Action. | ||
- Review and edit the release notes as necessary. Add notable changes, deprecation warnings, and useful upgrade information for users. | ||
- Once satisfied, publish the release. This will trigger the 'Promote Operator Release' GHA, which will publish the operator image to quay.io as well as build and push the bundle and catalog images. | ||
|
||
### 4. Post-Release Checks | ||
|
||
- Ensure that the images are correctly tagged on Quay. | ||
- Verify that the `operator.yaml` file is attached to the release and is correct. | ||
|
||
## Troubleshooting | ||
|
||
If you encounter issues during the release process: | ||
|
||
- Check the GitHub Action logs for any errors or warnings. | ||
- Verify that all prerequisites are met. | ||
- For more specific issues, refer to the workflow file `.github/workflows/stage.yml` for insights. | ||
|
||
## Notes | ||
|
||
- Do not manually tag or create releases; always use the automated workflow. | ||
- Ensure that you're familiar with the semantic versioning guidelines when assigning a version number. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters