Skip to content

catalog render

catalog render #80

Workflow file for this run

---
name: Release
on:
push:
branches:
- EVEREST-726-release-workflow
# workflow_dispatch:
# inputs:
# version:
# description: "The RC/Release version, format: X.Y.Z-rcN for RC, X.Y.Z for releases"
# required: true
permissions:
contents: read
packages: write
checks: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
env:
TOOLS_PATH: "/opt/tools/bin"
#VERSION: ${{ github.event.inputs.version }}
VERSION: 100.100.100-rc100
# version in format "X.Y" which is going to be updated with each patch release
FLOATING_TAG: ''
# branch name in format "release-X.Y"
BRANCH_NAME: ''
# GitHub tag name to use for the RC/Release
GH_TAG: ''
# Shows if this workflow is triggered for RC or Release
IS_RC: 0
ARCH: ''
OS: ''
steps:
- name: Validate input
run: |
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc[1-9][0-9]*)?$ ]]; then
echo "Wrong version format provided, please use "X.Y.Z-rcN" format for an RC or "X.Y.Z" format for a release"
exit 1
fi
- name: Set environment variables based on VERSION
run: |
floating_tag=${VERSION%.*}
echo "FLOATING_TAG=$floating_tag" >> $GITHUB_ENV
echo "BRANCH_NAME=release-$floating_tag" >> $GITHUB_ENV
echo "GH_TAG=v$VERSION" >> $GITHUB_ENV
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "IS_RC=1" >> $GITHUB_ENV
fi
echo "ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')" >> $GITHUB_ENV
echo "OS=$(uname | awk '{print tolower($0)}')" >> $GITHUB_ENV
- name: Operator - check out
uses: actions/checkout@v4
with:
repository: percona/everest-operator
path: everest-operator
token: ${{ secrets.ROBOT_TOKEN }}
# - name: Operator - create release branch
# run: |
# cd everest-operator
# # Check if the branch already exists
# git fetch
# check_branch=$(git ls-remote --heads origin ${BRANCH_NAME})
# if [[ -z ${check_branch} ]]; then
# git checkout -b $BRANCH_NAME
#
# # update version in the Makefile
# sed -i "s/0.0.0/$VERSION/g" Makefile
#
# make init
# make release
#
# # configure userdata for commits
# git config --global user.email "[email protected]"
# git config --global user.name "Everest RC CI triggered by ${{ github.actor }}"
#
# # commit and push the updated files
# git commit -a -m "update version"
#
# git push origin $BRANCH_NAME
#
# # comment tags to not trigger the existing workflow in the operator repo
# # git tag $GH_TAG
# # git push origin $GH_TAG
# else
# git checkout $BRANCH_NAME
# fi
# - name: Operator - install operator-sdk
# run: |
# mkdir -p $TOOLS_PATH
# echo $TOOLS_PATH >> $GITHUB_PATH
#
# export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.25.2
# curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
#
# gpg --keyserver keyserver.ubuntu.com --recv-keys 052996E2A20B5C7E
#
# curl -LO ${OPERATOR_SDK_DL_URL}/checksums.txt
# curl -LO ${OPERATOR_SDK_DL_URL}/checksums.txt.asc
# gpg -u "Operator SDK (release) <[email protected]>" --verify checksums.txt.asc
#
# grep operator-sdk_${OS}_${ARCH} checksums.txt | sha256sum -c -
#
# chmod +x operator-sdk_${OS}_${ARCH}
# mv operator-sdk_${OS}_${ARCH} $TOOLS_PATH/operator-sdk
#
# - name: Operator - build and bundle
# run: |
# cd everest-operator
# make build manifests bundle
- name: Operator - setup Docker meta for everest-operator
id: meta
uses: docker/metadata-action@v4
# docker/metadata-action action looks more elegant when being triggered by a GH tag,
# however this workflow can't be triggered by a GH tag since there are some changes need to be done
# in the codebase prior putting the tag, so the action uses the raw tags
with:
images: |
percona/everest-operator,enable=${{ env.IS_RC == 0 }}
perconalab/everest-operator
tags: |
type=raw,value=${{ env.VERSION }}
type=raw,value=${{ env.FLOATING_TAG }},enable=${{ env.IS_RC == 0 }}
type=raw,value=latest,enable=${{ env.IS_RC == 0 }}
- name: Operator - setup Docker meta for everest-operator-bundle
id: bundle_meta
uses: docker/metadata-action@v4
with:
images: |
percona/everest-operator-bundle,enable=${{ env.IS_RC == 0 }}
perconalab/everest-operator-bundle
tags: |
type=raw,value=${{ env.VERSION }}
type=raw,value=${{ env.FLOATING_TAG }},enable=${{ env.IS_RC == 0 }}
type=raw,value=latest,enable=${{ env.IS_RC == 0 }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Operator - build and push operator everest-operator image
# uses: docker/build-push-action@v3
# with:
# context: everest-operator
# # push: false
# push: true
# tags: ${{ steps.meta.outputs.tags }}
#
- name: Operator - build and push everest-operator-bundle image
uses: docker/build-push-action@v3
with:
context: everest-operator
# push: false
push: true
tags: ${{ steps.bundle_meta.outputs.tags }}
file: everest-operator/bundle.Dockerfile
- name: Catalog - checkout
uses: actions/checkout@v4
with:
repository: percona/everest-catalog
path: everest-catalog
token: ${{ secrets.ROBOT_TOKEN }}
- name: Catalog - create release branch
run: |
cd everest-catalog
# Check if the branch already exists
git fetch
check_branch=$(git ls-remote --heads origin ${BRANCH_NAME})
if [[ -z ${check_branch} ]]; then
git checkout -b $BRANCH_NAME
# update tag refs in scripts
sed -i "s/0.0.0/$VERSION/g" catalog/everest-operator/veneer.yaml
curl -Lo /tmp/opm https://github.com/operator-framework/operator-registry/releases/latest/download/linux-amd64-opm
chmod +x /tmp/opm
/tmp/opm alpha render-template semver -o yaml < ./catalog/everest-operator/veneer.yaml > ./catalog/everest-operator/catalog.yaml
git commit -a -m "update version"
git push origin $BRANCH_NAME
# comment tags to not trigger the existing workflow in the catalog repo
# git tag $GH_TAG
# git push origin $GH_TAG
fi
# TODO: push catalog images
# - name: Everest - check out
# uses: actions/checkout@v4
#
# - name: Create and update Everest Backend release branch
# run: |
# # Check if the branch already exists
# git fetch
# check_branch=$(git ls-remote --heads origin ${BRANCH_NAME})
#
# if [[ -z ${check_branch} ]]; then
# git checkout -b $BRANCH_NAME
# git push origin $BRANCH_NAME
#
# # update tag refs in scripts
# sed -i "s/0.0.0/$VERSION/g" deploy/quickstart-k8s.yaml
#
# # configure userdata for commits
# git config --global user.email "[email protected]"
# git config --global user.name "Everest RC CI triggered by ${{ github.actor }}"
#
# # commit and push the updated files
# git commit -a -m "update version tag"
# git push origin $BRANCH_NAME
# fi