Skip to content

Commit

Permalink
Merge pull request #135 from clobrano/automate-community-bundles-pr-0
Browse files Browse the repository at this point in the history
Update OKD Community bundle PR automation
  • Loading branch information
openshift-merge-bot[bot] authored Aug 7, 2024
2 parents d96afea + b03cf88 commit 2632f16
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 58 deletions.
48 changes: 5 additions & 43 deletions .github/workflows/post-submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,64 +12,26 @@ permissions:

jobs:
push_to_registry:
name: Build and push images to quay.io/medik8s
name: Build and push unversioned images to quay.io/medik8s
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: 'go.sum'

- name: Log in to Quay.io
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io

- name: Build and push CSV 0.0.1 + latest images, for pushes
if: ${{ github.ref_type != 'tag' }}
- name: Build and push CSV version v0.0.1 with latest images
run: make bundle container-build container-push

- name: Build and push versioned based on tag
if: ${{ github.ref_type == 'tag' }}
# remove leading 'v' from tag!
run: export VERSION=$(echo $GITHUB_REF_NAME | sed 's/v//') && make bundle container-build container-push

- name: Create release with manifests
if: ${{ github.ref_type == 'tag' }}
# https://github.com/marketplace/actions/github-release-create-update-and-upload-assets
uses: meeDamian/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
body: |
# Machine Deletion Remediation operator ${{ github.ref_name }}
## Notable Changes
* TODO
## Release Artifacts
### Images
* Operator: quay.io/medik8s/machine-deletion-remediation-operator:${{ github.ref_name }}
* Bundle: quay.io/medik8s/machine-deletion-remediation-operator-bundle:${{ github.ref_name }}
* Catalog aka Index: quay.io/medik8s/machine-deletion-remediation-operator-catalog:${{ github.ref_name }}
### Source code and OLM manifests
Please find the source code and the OLM manifests in the `Assets` section below.
gzip: folders
files: >
Manifests:bundle/
99 changes: 89 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,100 @@
name: Release bundle
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "The version to release, without the leading `v`"
required: true
previous_version:
description: "The previous version, used for the CVS's `replaces` field, without the leading `v`"
required: true
inputs:
operation:
description: "The operation to perform."
required: true
type: choice
default: "build_and_push_images"
options:
- build_and_push_images
- create_okd_release_pr
version:
description: "The version to release, without the leading `v`"
required: true
previous_version:
description: "The previous version, used for the CVS's `replaces` field, without the leading `v`"
required: true
ocp_version:
description: "The target OCP version for the release (mandatory for create_okd_release_pr option)"
required: true

permissions:
contents: write

jobs:
make_rh_community_bundle:
uses: medik8s/.github/.github/workflows/release_rh_community_bundle.yml@main
push_to_registry:
if: ${{ inputs.operation == 'build_and_push_images' }}
name: Build and push versioned images to quay.io/medik8s
runs-on: ubuntu-22.04
env:
VERSION: ${{ inputs.version }}
PREVIOUS_VERSION: ${{ inputs.previous_version }}
OCP_VERSION: ${{ inputs.ocp_version }}
steps:
- name: Log inputs
run: |
echo "Building version: ${VERSION},"
echo "which replaces version: ${PREVIOUS_VERSION}."
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Log in to Quay.io
uses: docker/login-action@v3
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io

- name: Build and push versioned CSV and images
run: VERSION=$VERSION PREVIOUS_VERSION=$PREVIOUS_VERSION make container-build container-push

- name: Create release with manifests
# https://github.com/marketplace/actions/github-release-create-update-and-upload-assets
uses: meeDamian/[email protected]
with:
tag: v${{ inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
body: |
# Machine Deletion Remediation operator v${{ inputs.version }}
## Notable Changes
* TODO
## Release Artifacts
### Images
* Operator: quay.io/medik8s/machine-deletion-remediation-operator:${{ inputs.version }}
* Bundle: quay.io/medik8s/machine-deletion-remediation-operator-bundle:${{ inputs.version }}
* Catalog aka Index: quay.io/medik8s/machine-deletion-remediation-operator-catalog:${{ inputs.version }}
### Source code and OLM manifests
Please find the source code and the OLM manifests in the `Assets` section below.
gzip: folders
files: >
Manifests:bundle/
create_okd_release_pr:
if: inputs.operation == 'create_okd_release_pr'
uses: medik8s/.github/.github/workflows/release_community_bundle_parametric.yaml@main
secrets: inherit
with:
version: ${{ inputs.version }}
previous_version: ${{ inputs.previous_version }}
ocp_version: ${{ inputs.ocp_version }}
community: 'OKD'
make_targets: "bundle-community-okd"
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ GOIMPORTS_VERSION ?= v0.17.0
# Sort-imports versions at https://github.com/slintes/sort-imports/releases
SORT_IMPORTS_VERSION = v0.2.1

# OCP Version: for OKD bundle community
OCP_VERSION = 4.12

# update for major version updates to YQ_VERSION! see https://github.com/mikefarah/yq
YQ_API_VERSION = v4
YQ_VERSION = v4.44.2
Expand Down Expand Up @@ -335,8 +332,8 @@ verify-previous-version: ## Verifies that PREVIOUS_VERSION variable is set
exit 1; \
fi

.PHONY: bundle-community-rh
bundle-community-rh: bundle ## Update displayName field in the bundle's CSV
.PHONY: bundle-community-okd
bundle-community-okd: bundle ## Update displayName field in the bundle's CSV
sed -r -i "s|displayName: Machine Deletion Remediation operator.*|displayName: Machine Deletion Remediation Operator - Community Edition|;" ${CSV}
$(MAKE) add-ocp-annotations
echo -e "\n # Annotations for OCP\n com.redhat.openshift.versions: \"v${OCP_VERSION}\"" >> bundle/metadata/annotations.yaml
Expand Down

0 comments on commit 2632f16

Please sign in to comment.