Skip to content

Create Release and Publish to Community Operators #160

Create Release and Publish to Community Operators

Create Release and Publish to Community Operators #160

name: Create Release and Publish to Community Operators
on:
workflow_dispatch:
inputs:
version:
description: 'The semantic version of the release (e.g. v1.2.3)'
required: true
previous_version:
description: 'The semantic version of the previous release (e.g. v1.2.3)'
required: true
branch:
description: 'The branch to create the release from (defaults to main)'
required: false
default: 'main'
operator_channels:
description: |
Channel(s), comma separated, to which this operator version belongs.
First in list is assumed default channel.
required: true
type: string
jobs:
release-bases:
runs-on: ubuntu-20.04
strategy:
fail-fast: true
steps:
- name: rulesets
uses: konveyor/release-tools/create-release@main
with:
version: ${{ inputs.version }}
prev_version: ${{ inputs.previous_version }}
repository: konveyor/rulesets
ref: ${{ inputs.branch }}
github_token: ${{ secrets.GH_TOKEN }}
- name: static-report
uses: konveyor/release-tools/create-release@main
with:
version: ${{ inputs.version }}
prev_version: ${{ inputs.previous_version }}
repository: konveyor/static-report
ref: ${{ inputs.branch }}
github_token: ${{ secrets.GH_TOKEN }}
- name: wait for static-report
run: |
#!/bin/bash
while ! docker pull quay.io/konveyor/static-report:${{ inputs.version }} &> /dev/null; do
sleep 3m
done
docker image inspect quay.io/konveyor/static-report:${{ inputs.version }}
- name: java-analyzer-bundle
uses: konveyor/release-tools/create-release@main
with:
version: ${{ inputs.version }}
prev_version: ${{ inputs.previous_version }}
repository: konveyor/java-analyzer-bundle
ref: ${{ inputs.branch }}
github_token: ${{ secrets.GH_TOKEN }}
- name: wait for java-analyzer-bundle
run: |
#!/bin/bash
while ! docker pull quay.io/konveyor/jdtls-server-base:${{ inputs.version }} &> /dev/null; do
sleep 3m
done
docker image inspect quay.io/konveyor/jdtls-server-base:${{ inputs.version }}
- name: analyzer-lsp
uses: konveyor/release-tools/create-release@main
with:
version: ${{ inputs.version }}
prev_version: ${{ inputs.previous_version }}
repository: konveyor/analyzer-lsp
ref: ${{ inputs.branch }}
github_token: ${{ secrets.GH_TOKEN }}
- name: wait for analyzer-lsp
run: |
#!/bin/bash
while ! docker pull quay.io/konveyor/analyzer-lsp:${{ inputs.version }} &> /dev/null; do
sleep 3m
done
docker image inspect quay.io/konveyor/analyzer-lsp:${{ inputs.version }}
- name: windup-shim
uses: konveyor/release-tools/create-release@main
with:
version: ${{ inputs.version }}
prev_version: ${{ inputs.previous_version }}
repository: konveyor/windup-shim
ref: ${{ inputs.branch }}
github_token: ${{ secrets.GH_TOKEN }}
- name: wait for windup-shim
run: |
#!/bin/bash
while ! docker pull quay.io/konveyor/windup-shim:${{ inputs.version }} &> /dev/null; do
sleep 3m
done
docker image inspect quay.io/konveyor/windup-shim:${{ inputs.version }}
- name: tackle2-addon-analyzer
uses: konveyor/release-tools/create-release@main
with:
version: ${{ inputs.version }}
prev_version: ${{ inputs.previous_version }}
repository: konveyor/tackle2-addon-analyzer
ref: ${{ inputs.branch }}
github_token: ${{ secrets.GH_TOKEN }}
- name: wait for tackle2-addon-analyzer
run: |
#!/bin/bash
while ! docker pull quay.io/konveyor/tackle2-addon-analyzer:${{ inputs.version }} &> /dev/null; do
sleep 3m
done
docker image inspect quay.io/konveyor/tackle2-addon-analyzer:${{ inputs.version }}
- name: tackle2-addon-discovery
uses: konveyor/release-tools/create-release@main
with:
version: ${{ inputs.version }}
prev_version: ${{ inputs.previous_version }}
repository: konveyor/tackle2-addon-discovery
ref: ${{ inputs.branch }}
github_token: ${{ secrets.GH_TOKEN }}
- name: wait for tackle2-addon-discovery
run: |
#!/bin/bash
while ! docker pull quay.io/konveyor/tackle2-addon-discovery:${{ inputs.version }} &> /dev/null; do
sleep 3m
done
docker image inspect quay.io/konveyor/tackle2-addon-discovery:${{ inputs.version }}
release-components:
runs-on: ubuntu-20.04
needs: release-bases
strategy:
matrix:
projects:
- repo: konveyor/tackle2-hub
image: konveyor/tackle2-hub
- repo: konveyor/tackle2-ui
image: konveyor/tackle2-ui
- repo: konveyor/tackle2-addon
image: ''
- repo: konveyor/operator
image: konveyor/tackle2-operator
- repo: konveyor/tackle-keycloak-theme
image: konveyor/tackle-keycloak-init
- repo: konveyor/kantra
image: konveyor/kantra
- repo: konveyor/tackle2-addon-discovery
image: konveyor/tackle2-addon-discovery
fail-fast: true
steps:
- uses: konveyor/release-tools/create-release@main
with:
version: ${{ inputs.version }}
prev_version: ${{ inputs.previous_version }}
repository: ${{ matrix.projects.repo }}
ref: ${{ inputs.branch }}
github_token: ${{ secrets.GH_TOKEN }}
- if: ${{ matrix.projects.image != '' }}
run: |
#!/bin/bash
while ! docker pull quay.io/${{ matrix.projects.image }}:${{ inputs.version }} &> /dev/null; do
sleep 3m
done
docker image inspect quay.io/${{ matrix.projects.image }}:${{ inputs.version }}
build-bundle:
name: Build Bundle Manifest
needs: release-components
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- name: Checkout Push to Registry action
uses: actions/checkout@v4
with:
path: operator
ref: ${{ inputs.branch }}
- name: Log in to Quay.io
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_PUBLISH_ROBOT }}
password: ${{ secrets.QUAY_PUBLISH_TOKEN }}
- name: Mirror non-konveyor images
working-directory: ./operator
run: |
make yq openshift-client
IMAGE_ORG="quay.io/konveyor"
VERSION="${{ inputs.version }}"
CSV="./bundle/manifests/konveyor-operator.clusterserviceversion.yaml"
for full_image in $(yq eval '.spec.relatedImages[] | .image' "${CSV}"); do
image="${full_image%:*}"
full_image_name="${image#*/}"
image_name="${full_image_name#*/}"
mirror_image_name="${IMAGE_ORG}/${image_name}:${VERSION}"
if ! [[ "${full_image}" =~ "${IMAGE_ORG}"/.* ]]; then
set -x
oc image mirror "${full_image}" "${mirror_image_name}" || {
echo "ERROR unable to mirror image"
exit 1
}
fi
done
- name: Build bundle
uses: ./operator/.github/actions/make-bundle
with:
operator_bundle: quay.io/konveyor/tackle2-operator-bundle:${{ inputs.version }}
operator: quay.io/konveyor/tackle2-operator:${{ inputs.version }}
tackle_hub: quay.io/konveyor/tackle2-hub:${{ inputs.version }}
keycloak_init: quay.io/konveyor/tackle-keycloak-init:${{ inputs.version }}
tackle_ui: quay.io/konveyor/tackle2-ui:${{ inputs.version }}
addon_analyzer: quay.io/konveyor/tackle2-addon-analyzer:${{ inputs.version }}
addon_discovery: quay.io/konveyor/tackle2-addon-discovery:${{ inputs.version }}
provider_generic: quay.io/konveyor/generic-external-provider:${{ inputs.version }}
provider_java: quay.io/konveyor/java-external-provider:${{ inputs.version }}
# The ones we don't own
oauth_proxy: quay.io/konveyor/origin-oauth-proxy:${{ inputs.version }}
tackle_postgres: quay.io/konveyor/postgresql-15-c9s:${{ inputs.version }}
keycloak_sso: quay.io/konveyor/keycloak:${{ inputs.version }}
# Bundle specific args
version: ${{ inputs.version }}
channels: ${{ inputs.operator_channels }}
- name: Replace with digest
working-directory: ./operator
run: |
CSV="./bundle/manifests/konveyor-operator.clusterserviceversion.yaml"
# Handle operator image
operator_full_image=$(yq eval '.metadata.annotations.containerImage' "${CSV}")
operator_image="${operator_full_image%:*}"
podman pull "${operator_full_image}"
operator_image_sha=$(podman inspect "${operator_full_image}" --format '{{ .Digest }}')
sed -i "s,${operator_full_image},${operator_image}@${operator_image_sha},g" "${CSV}"
# Handle related images
for full_image in $(yq eval '.spec.relatedImages[] | .image' "${CSV}"); do
image="${full_image%:*}"
podman pull "${full_image}"
image_sha=$(podman inspect "${full_image}" --format '{{ .Digest }}')
sed -i "s,${full_image},${image}@${image_sha},g" "${CSV}"
done
- name: Update bundle annotations
working-directory: ./operator
run: |
ANNOTATIONS="./bundle/metadata/annotations.yaml"
yq eval --inplace 'del(.annotations["operators.operatorframework.io.test.mediatype.v1"])' ${ANNOTATIONS}
yq eval --inplace 'del(.annotations["operators.operatorframework.io.test.config.v1"])' ${ANNOTATIONS}
yq eval --inplace '.annotations["com.redhat.openshift.versions"] = "v4.9" | .annotations["com.redhat.openshift.versions"] style="double"' ${ANNOTATIONS}
- name: Build and Push Bundle Image
working-directory: ./operator
env:
BUNDLE_IMG: quay.io/konveyor/tackle2-operator-bundle:${{ inputs.version }}
run: make bundle-build bundle-push
test:
name: Test Konveyor
needs: build-bundle
uses: konveyor/ci/.github/workflows/global-ci-bundle.yml@main
with:
operator_bundle: quay.io/konveyor/tackle2-operator-bundle:${{ inputs.version }}
api_tests_ref: ${{ inputs.branch }}
ui_tests_ref: ${{ inputs.branch }}
publish-bundle:
name: Publish Bundle Manifest
needs: test
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- name: Create scratch bundle image
run: |
docker create --name extract "quay.io/konveyor/tackle2-operator-bundle:${{ inputs.version }}" foo
- name: Checkout community operators
uses: actions/checkout@v4
with:
repository: k8s-operatorhub/community-operators
path: community-operators
ref: main
fetch-depth: 0
- name: Update community operators
working-directory: ./community-operators
run: |
version="${{ inputs.version }}"
co_version="${version:1}"
operator_path="./operators/konveyor-operator/${co_version}"
mkdir -p "${operator_path}"
docker cp extract:/metadata "${operator_path}"
docker cp extract:/manifests "${operator_path}"
git diff
- name: Checkout redhat community operators
uses: actions/checkout@v4
with:
repository: redhat-openshift-ecosystem/community-operators-prod
path: redhat-community-operators
ref: main
fetch-depth: 0
- name: Update redhat community operators
working-directory: ./redhat-community-operators
run: |
version="${{ inputs.version }}"
co_version="${version:1}"
operator_path="./operators/konveyor-operator/${co_version}"
mkdir -p "${operator_path}"
docker cp extract:/metadata "${operator_path}"
docker cp extract:/manifests "${operator_path}"
git diff
- name: Make unified changelog
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
repositories=(
"konveyor/tackle2-ui"
"konveyor/tackle2-hub"
"konveyor/analyzer-lsp"
"konveyor/java-analyzer-bundle"
"konveyor/windup-shim"
"konveyor/tackle2-addon-analyzer"
"konveyor/tackle2-addon-discovery"
"konveyor/tackle2-addon"
"konveyor/operator"
)
echo "Konveyor Operator ${{ inputs.version }}" > changelog.md
echo "=======================================" >> changelog.md
echo "" >> changelog.md
for repo in "${repositories[@]}"; do
echo "# ${repo}" >> changelog.md
echo "" >> changelog.md
gh release view "${{ inputs.version }}" --repo "${repo}" --json body --jq .body >> changelog.md
echo "" >> changelog.md
done
- name: Create Pull Request - Community Operators
uses: peter-evans/create-pull-request@v5
id: co-cpr
with:
token: ${{ secrets.GH_TOKEN }}
path: ./community-operators
commit-message: "konveyor-operator-${{ inputs.version }}"
committer: "${{ secrets.GH_USER }} <noreply@github.com>"
author: "${{ secrets.GH_USER }} <${{ secrets.GH_USER }}@users.noreply.github.com>"
signoff: true
branch: ${{ inputs.version }}
push-to-fork: konveyor-release-bot/community-operators
title: "konveyor-operator-${{ inputs.version }}"
body-path: ./changelog.md
- name: Create Pull Request - Red Hat Community Operators
uses: peter-evans/create-pull-request@v5
id: rhco-cpr
with:
token: ${{ secrets.GH_TOKEN }}
path: ./redhat-community-operators
commit-message: "konveyor-operator-${{ inputs.version }}"
committer: "${{ secrets.GH_USER }} <noreply@github.com>"
author: "${{ secrets.GH_USER }} <${{ secrets.GH_USER }}@users.noreply.github.com>"
signoff: true
branch: ${{ inputs.version }}
push-to-fork: konveyor-release-bot/community-operators-prod
title: "konveyor-operator-${{ inputs.version }}"
body-path: ./changelog.md
- name: PR Notifications
run: |
echo "::notice:: Community Operators Pull Request URL - ${{ steps.co-cpr.outputs.pull-request-url }}"
echo "::notice:: Red Hat Community Operators Pull Request URL - ${{ steps.rhco-cpr.outputs.pull-request-url }}"