-
Notifications
You must be signed in to change notification settings - Fork 153
140 lines (136 loc) · 6.46 KB
/
publish-community-operators.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Publish Tagged Version to Community Operators
on:
push:
tags:
- v1.*
jobs:
publish_hco:
if: (github.repository == 'kubevirt/hyperconverged-cluster-operator' && !contains(github.ref, 'unstable'))
name: Publish HCO tagged version to community-operators
runs-on: ubuntu-latest
env:
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
REGISTRY_NAMESPACE: kubevirt
OPM_VERSION: v1.35.0
steps:
- name: resolve the correct branch of the tag
run: |
GIT_TAG=${{ github.ref }}
TAGGED_VERSION=${GIT_TAG##*/v}
TAGGED_MINOR_VERSION=${TAGGED_VERSION%.*}
REPO_BRANCHES=$(curl https://api.github.com/repos/kubevirt/hyperconverged-cluster-operator/branches | jq .[].name)
if [[ "${REPO_BRANCHES[@]}" =~ "release-${TAGGED_MINOR_VERSION}" ]]
then
TARGET_BRANCH=release-${TAGGED_MINOR_VERSION}
else
TARGET_BRANCH=main
fi
echo "TARGET_BRANCH=${TARGET_BRANCH}" >> $GITHUB_ENV
echo "TAGGED_VERSION=${TAGGED_VERSION}" >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Checkout the latest code of ${{ env.TARGET_BRANCH }} branch
uses: actions/checkout@v4
with:
ref: ${{ env.TARGET_BRANCH }}
fetch-depth: 2
- name: Get latest version on ${{ env.TARGET_BRANCH }} branch
run: |
PACKAGE_DIR="./deploy/olm-catalog/community-kubevirt-hyperconverged"
CSV_VERSION=$(ls -d ${PACKAGE_DIR}/*/ | sort -rV | awk "NR==1" | cut -d '/' -f 5)
echo "CSV_VERSION=${CSV_VERSION}" >> $GITHUB_ENV
echo "PACKAGE_DIR=${PACKAGE_DIR}" >> $GITHUB_ENV
- name: Build Applications Images
env:
IMAGE_TAG: ${{ env.CSV_VERSION }}
run: |
IMAGE_TAG=${CSV_VERSION} make container-build
- name: Push Application Images
env:
IMAGE_TAG: ${{ env.CSV_VERSION }}
run: |
make quay-login
IMAGE_TAG=${IMAGE_TAG} make container-push
- name: Build Digester
run: |
(cd tools/digester && go build .)
- name: Build Manifests for version ${{ env.CSV_VERSION }}
env:
PACKAGE_DIR: ${{ env.PACKAGE_DIR }}
CSV_VERSION: ${{ env.CSV_VERSION }}
run: |
export HCO_OPERATOR_IMAGE=$(tools/digester/digester --image="quay.io/kubevirt/hyperconverged-cluster-operator:${CSV_VERSION}")
export HCO_WEBHOOK_IMAGE=$(tools/digester/digester --image="quay.io/kubevirt/hyperconverged-cluster-webhook:${CSV_VERSION}")
export HCO_DOWNLOADS_IMAGE=$(tools/digester/digester --image="quay.io/kubevirt/virt-artifacts-server:${CSV_VERSION}")
./hack/build-manifests.sh
sed -i "/^ \+replaces:/d" ${PACKAGE_DIR}/${CSV_VERSION}/manifests/kubevirt-hyperconverged-operator.v${CSV_VERSION}.clusterserviceversion.yaml
- name: Get opm client
run: |
mkdir -p _out
wget "https://github.com/operator-framework/operator-registry/releases/download/${OPM_VERSION}/linux-amd64-opm" -O _out/opm
chmod +x _out/opm
- name: Build and Push the Index Image
run: |
export OPM=$(pwd)/_out/opm
./hack/build-index-image.sh ${{ env.CSV_VERSION }}
- name: Run Publisher script
run: |
export TAGGED_VERSION=${{ env.TAGGED_VERSION }}
export TARGET_BRANCH=${{ env.TARGET_BRANCH }}
export HCO_BOT_TOKEN=${{ secrets.HCO_BOT_TOKEN }}
curl https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/main/automation/publisher/publisher.sh | bash
- name: get next version
env:
CSV_VERSION: ${{ env.CSV_VERSION }}
run: |
NEW_VERSION=$(./hack/get-next-version.sh "${CSV_VERSION}")
NEW_IMAGE_TAG="${NEW_VERSION}-unstable"
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
echo "NEW_IMAGE_TAG=${NEW_IMAGE_TAG}" >> $GITHUB_ENV
- name: Build Applications next version Images
env:
NEW_IMAGE_TAG: ${{ env.NEW_IMAGE_TAG }}
run: |
IMAGE_TAG=${NEW_IMAGE_TAG} make container-build
- name: Push next version Application Images
env:
NEW_IMAGE_TAG: ${{ env.NEW_IMAGE_TAG }}
run: |
IMAGE_TAG=${NEW_IMAGE_TAG} make container-push
- name: run manifest for next version
env:
PACKAGE_DIR: ${{ env.PACKAGE_DIR }}
CSV_VERSION: ${{ env.NEW_VERSION }}
run: |
mkdir -p "${PACKAGE_DIR}/${CSV_VERSION}"
./hack/build-manifests.sh
VERSION_4_SED=$(echo "${CSV_VERSION}" | sed -E "s|\.|\\\\\\\\\\\.|g")
sed -i -E "s|(ARG VERSION=).*|\1${CSV_VERSION}|g" deploy/index-image/bundle.Dockerfile
sed -i -E "s|(ARG INITIAL_VERSION=).*|\1${CSV_VERSION}|g;s|(ARG INITIAL_VERSION_SED=).*|\1\"${VERSION_4_SED}\"|g" deploy/index-image/Dockerfile.bundle.ci-index-image-upgrade
sed -i -E "s|(ARG VERSION=).*|\1${CSV_VERSION}|g" deploy/olm-catalog/bundle.Dockerfile
sed -i -E "s|(ARG INITIAL_VERSION=).*|\1${CSV_VERSION}|g;s|(ARG INITIAL_VERSION_SED=).*|\1\"${VERSION_4_SED}\"|g" deploy/olm-catalog/Dockerfile.bundle.ci-index-image-upgrade
sed -i -E "s|(quay.io/kubevirt/hyperconverged-cluster-bundle:).*|\1${CSV_VERSION}|g" deploy/olm-catalog/community-kubevirt-hyperconverged/index-template-release.yaml
sed -i -E "s|(quay.io/kubevirt/hyperconverged-cluster-bundle:).*|\1${CSV_VERSION}|g" deploy/olm-catalog/community-kubevirt-hyperconverged/index-template-unstable.yaml
git add ./deploy/
echo "CHANGED=true" >> $GITHUB_ENV
- uses: peter-evans/create-pull-request@v6
if: ${{ env.CHANGED }}
with:
token: ${{ secrets.HCO_BOT_TOKEN }}
commit-message: |
Prepare version ${{ env.NEW_VERSION }}
Signed-off-by: HCO Bump Bot <[email protected]>
committer: HCO Bump Bot <[email protected]>
title: "Prepare version ${{ env.NEW_VERSION }}"
body: |
Prepare version ${{ env.NEW_VERSION }}
Executed by HCO Release-Bumper Bot.
```release-note
Prepare version ${{ env.NEW_VERSION }}
```
assignees: tiraboschi,orenc1,nunnatsa,machadovilaca,dharmit
reviewers: tiraboschi,orenc1,nunnatsa,machadovilaca,dharmit
branch: prepare_version_${{ env.NEW_VERSION }}