Repository navigation
164 lines (153 loc) · 7.3 KB
/
Copy pathrelease.yml
File metadata and controls
164 lines (153 loc) · 7.3 KB
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#
# Copyright (c) 2019-2026 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#
# This Workflow performs a full release of che-operator
name: Release Che Operator
run-name: Release Che Operator ${{ inputs.version }} on ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
version:
description: 'The version that is going to be released. Should be in format 7.yy.z'
required: true
forceRecreateTags:
description: If true, tags will be recreated. Use with caution
required: false
default: 'false'
dryRun:
description: If true, dry run will be performed. No changes will be pushed to the repository
required: false
default: 'false'
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
fetch-depth: 0
- name: Display release parameters
env:
VERSION: ${{ inputs.version }}
FORCE_RECREATE_TAGS: ${{ inputs.forceRecreateTags }}
DRY_RUN: ${{ inputs.dryRun }}
REF_NAME: ${{ github.ref_name }}
COMMIT_SHA: ${{ github.sha }}
TRIGGERED_BY: ${{ github.actor }}
run: |
echo "=== Release Parameters ==="
echo "Version: ${VERSION}"
echo "Force recreate tags: ${FORCE_RECREATE_TAGS}"
echo "Dry run: ${DRY_RUN}"
echo "Branch: ${REF_NAME}"
echo "Commit SHA: ${COMMIT_SHA}"
echo "Triggered by: ${TRIGGERED_BY}"
echo "=========================="
# Validate version format
[[ "${VERSION}" =~ ^7\.[0-9]+\.[0-9]+$ ]] || { echo "[ERROR] Invalid version: ${VERSION}"; exit 1; }
- name: Check existing tags
env:
VERSION: ${{ github.event.inputs.version }}
RECREATE_TAGS: ${{ github.event.inputs.forceRecreateTags }}
run: |
set +e
EXISTING_TAG=$(git ls-remote --exit-code origin refs/tags/${VERSION})
if [[ -n ${EXISTING_TAG} ]]; then
if [[ ${RECREATE_TAGS} == "true" ]]; then
echo "[INFO] Removing tag for ${VERSION} version. New tag will be recreated during release."
git push origin :$VERSION
else
echo "[ERROR] Cannot proceed with release - tag ${EXISTING_TAG} already exists."
exit 1
fi
else
echo "[INFO] No existing tags detected for ${VERSION}"
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Set up Python 3.9
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
with:
python-version: 3.9
- name: Install yq, semver, podman and base32 wrapper
run: |
python -m pip install --upgrade pip
pip install yq
pip install semver
# the release gate checks the pinned images with podman, which this runner lacks
sudo apt-get -y -q install podman
# get base32 util from che-release project
wget https://raw.githubusercontent.com/eclipse/che-release/master/utils/base32
# copy base32 python-based helper script into dir that's accessed from PATH (so it's accessible to this and other called scripts)
sudo cp -f $(pwd)/base32 /usr/local/bin/
sudo chmod +x /usr/local/bin/base32
#remove base32 from current directory to avoid it being commited during release
rm $(pwd)/base32
- name: Set up Go 1.26.5
uses: actions/setup-go@be3c94b385c4f180051c996d336f57a34c397495 # v3.6.1
with:
go-version: 1.26.5
- name: Release operator
env:
CHE_VERSION: ${{ github.event.inputs.version }}
DRY_RUN: ${{ github.event.inputs.dryRun }}
FORCE_RECREATE_TAGS: ${{ github.event.inputs.forceRecreateTags }}
GITHUB_TOKEN: ${{ secrets.CHE_BOT_GITHUB_TOKEN }}
QUAY_ECLIPSE_CHE_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_ECLIPSE_CHE_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
QUAY_CHE_INCUBATOR_USERNAME: ${{ secrets.QUAY_CHE_INCUBATOR_USERNAME }}
QUAY_CHE_INCUBATOR_PASSWORD: ${{ secrets.QUAY_CHE_INCUBATOR_PASSWORD }}
QUAY_USERNAME_K8S: ${{ secrets.QUAY_ECLIPSE_CHE_OPERATOR_KUBERNETES_USERNAME }}
QUAY_PASSWORD_K8S: ${{ secrets.QUAY_ECLIPSE_CHE_OPERATOR_KUBERNETES_PASSWORD }}
QUAY_USERNAME_OS: ${{ secrets.QUAY_ECLIPSE_CHE_OPERATOR_OPENSHIFT_USERNAME }}
QUAY_PASSWORD_OS: ${{ secrets.QUAY_ECLIPSE_CHE_OPERATOR_OPENSHIFT_PASSWORD }}
run: |
if [[ ${DRY_RUN} == "true" ]]; then DRY_RUN_FLAG="--dry-run"; fi
echo "CHE_VERSION=${CHE_VERSION}"
echo "DRY_RUN_FLAG=${DRY_RUN_FLAG}"
BRANCH=${CHE_VERSION%.*}.x
echo "BRANCH=${BRANCH}"
git config --global user.name "Mykhailo Kuznietsov"
git config --global user.email "mkuznets@redhat.com"
set -e
go install golang.org/x/tools/cmd/goimports@latest
export PATH="$PATH:$OP_SDK_DIR"
if [[ ${CHE_VERSION} == *".0" ]]; then
build/scripts/release/make-release.sh ${CHE_VERSION} --release --check-resources --release-olm-files ${DRY_RUN_FLAG}
else
git checkout ${BRANCH}
build/scripts/release/make-release.sh ${CHE_VERSION} --release --release-olm-files ${DRY_RUN_FLAG}
fi
# default robot account on quay does not have permissions for application repos
# so we provide credentials for accounts that do
git checkout ${CHE_VERSION}-release
build/scripts/release/make-release.sh ${CHE_VERSION} --push-olm-bundles ${DRY_RUN_FLAG}
# perform extra checkouts to ensure branches exist locally
git checkout ${BRANCH}
git checkout ${CHE_VERSION}-release
force_update=""
if [[ ${FORCE_RECREATE_TAGS} == "true" ]]; then force_update="--force"; fi
build/scripts/release/make-release.sh ${CHE_VERSION} --push-git-changes --pull-requests ${force_update} ${DRY_RUN_FLAG}
#- name: Create failure MM message
#if: ${{ failure() }}
#run: |
#echo "{\"text\":\":no_entry_sign: Che Operator ${{ github.event.inputs.version }} release has failed: https://github.com/eclipse-che/che-operator/actions/workflows/release.yml\"}" > mattermost.json
#- name: Create success MM message
#run: |
#echo "{\"text\":\":white_check_mark: Che Operator ${{ github.event.inputs.version }} release PR have been created: https://github.com/eclipse-che/che-operator/pulls/che-bot\"}" > mattermost.json
#- name: Send MM message
#if: ${{ success() }} || ${{ failure() }}
#uses: mattermost/action-mattermost-notify@1.1.0
#env:
#MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
#MATTERMOST_CHANNEL: eclipse-che-releases
#MATTERMOST_USERNAME: che-bot