Skip to content

Commit 68916d7

Browse files
authored
CLOUDP-362278: Fix RH script bundle/test copy (#2977)
* CLOUDP-362278: Fix RH script bundle/test copy * fix reset and document it * Remove need to store SBOMs in S3
1 parent d5780ac commit 68916d7

File tree

4 files changed

+122
-12
lines changed

4 files changed

+122
-12
lines changed

docs/dev/release.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,6 @@ $ make augment-sbom SBOM_JSON_FILE="temp/linux_amd64.sbom.json"
179179
$ make augment-sbom SBOM_JSON_FILE="temp/linux_arm64.sbom.json"
180180
```
181181

182-
### Register SBOMs internally
183-
184-
To be able to store SBOMs in S3, you need special credentials.
185-
Please advise the Wiki page "Kubernetes Atlas Operator SSDLC Compliance Manual".
186-
187-
```shell
188-
$ make store-augmented-sboms VERSION=${VERSION} TARGET_ARCH=amd64 SBOMS_DIR=temp
189-
$ make store-augmented-sboms VERSION=${VERSION} TARGET_ARCH=arm64 SBOMS_DIR=temp
190-
```
191-
192182
## Synchronize configuration changes with the Helm Charts
193183

194184
Go to the [helm-chart repo](https://github.com/mongodb/helm-charts) and locate the [Pull Request](https://github.com/mongodb/helm-charts/pulls)
@@ -286,6 +276,28 @@ You can see an [example fixed PR here for certified version 1.9.1](https://githu
286276
287277
After the PR is approved it will soon appear in the [Atlas Operator openshift cluster](https://console-openshift-console.apps.atlas.operator.mongokubernetes.com)
288278
279+
### Fix a RedHat PR
280+
281+
If there is a bug in the Redhat PRs, those are best fixed by closing the wrong PR in review and re-issuing a new one from a freshly made branch.
282+
283+
In order to redo a PR:
284+
285+
1. Close the broken PR(s) at Github.
286+
1. Fix the isue in the AKO code and merge it.
287+
1. Reset the local repo copy to re-issue the release using `./script/reset-rh.sh`
288+
1. Issue the PR again following the normal instructions above for each PR.
289+
290+
The `./script/reset-rh.sh` script usage is:
291+
292+
```shell
293+
$ ./script/reset-rh.sh all # to reset all 3 repos
294+
```
295+
Or select one or more of `community`, `openshift` or `certified` separated by commas to reset one or more selectively. For example:
296+
```shell
297+
$ ./script/reset-rh.sh community,certified # to reset community and certified repos only
298+
```
299+
300+
289301
# Post install hook release
290302

291303
If changes have been made to the post install hook (mongodb-atlas-kubernetes/cmd/post-install/main.go).

scripts/release-redhat-certified.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ cd -
3939

4040
pwd
4141

42-
cp -r releases/v${VERSION}/bundle.Dockerfile releases/v${VERSION}/bundle/manifests releases/v${VERSION}/bundle/metadata bundle/tests "${REPO}/${VERSION}"
42+
cp -r releases/v${VERSION}/bundle.Dockerfile releases/v${VERSION}/bundle/manifests releases/v${VERSION}/bundle/metadata releases/v${VERSION}/bundle/tests "${REPO}/${VERSION}"
4343

4444
# Replace deployment image version with SHA256
4545
value="${IMG_SHA_AMD64}" yq e -i '.spec.install.spec.deployments[0].spec.template.spec.containers[0].image = "quay.io/mongodb/mongodb-atlas-kubernetes-operator@" + env(value)' \

scripts/release-redhat.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set -eou pipefail
1919
version=${1:?"pass the version as the parameter, e.g \"0.5.0\""}
2020
repo="${RH_COMMUNITY_OPERATORHUB_REPO_PATH}/operators/mongodb-atlas-kubernetes"
2121
mkdir "${repo}/${version}"
22-
cp -r releases/v${version}/bundle.Dockerfile releases/v${version}/bundle/manifests releases/v${version}/bundle/metadata bundle/tests "${repo}/${version}"
22+
cp -r releases/v${version}/bundle.Dockerfile releases/v${version}/bundle/manifests releases/v${version}/bundle/metadata releases/v${version}/bundle/tests "${repo}/${version}"
2323

2424
cd "${repo}"
2525
git fetch upstream main

scripts/reset-rh.sh

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#!/bin/bash
2+
# Copyright 2025 MongoDB Inc
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -euo pipefail
17+
18+
# Check if an argument is provided
19+
if [ -z "$1" ]; then
20+
echo "Error: No target specified."
21+
echo "Usage: $0 [all | <target_string>]"
22+
echo " all : Resets community, openshift, and certified operators."
23+
echo " <target_string> : Resets specific operators if the string contains:"
24+
echo " 'community', 'openshift', or 'certified'."
25+
echo "Example: $0 'community certified' (resets both)"
26+
exit 1
27+
fi
28+
29+
TARGET="$1"
30+
31+
function reset_community() {
32+
echo "Remove prev version branch locally and remotely"
33+
pushd "${RH_COMMUNITY_OPERATORHUB_REPO_PATH}"
34+
git checkout main
35+
git branch -D "mongodb-atlas-operator-community-${VERSION}"
36+
git push origin ":mongodb-atlas-operator-community-${VERSION}"
37+
popd
38+
}
39+
40+
function reset_openshift() {
41+
echo "Remove prev version branch locally and remotely"
42+
pushd "${RH_COMMUNITY_OPENSHIFT_REPO_PATH}"
43+
git checkout main
44+
git branch -D "mongodb-atlas-operator-community-${VERSION}"
45+
git push origin ":mongodb-atlas-operator-community-${VERSION}"
46+
popd
47+
}
48+
49+
function reset_certified() {
50+
echo "Remove prev version branch locally and remotely"
51+
pushd "${RH_CERTIFIED_OPENSHIFT_REPO_PATH}"
52+
git checkout main
53+
git branch -D "mongodb-atlas-kubernetes-operator-${VERSION}"
54+
git push origin ":mongodb-atlas-kubernetes-operator-${VERSION}"
55+
popd
56+
}
57+
58+
TARGET_LOWER=$(echo "$TARGET" | tr '[:upper:]' '[:lower:]')
59+
60+
RUN_COMMUNITY=false
61+
RUN_OPENSHIFT=false
62+
RUN_CERTIFIED=false
63+
64+
if [[ "$TARGET_LOWER" == "all" ]]; then
65+
RUN_COMMUNITY=true
66+
RUN_OPENSHIFT=true
67+
RUN_CERTIFIED=true
68+
else
69+
if [[ "$TARGET_LOWER" == *"community"* ]]; then
70+
RUN_COMMUNITY=true
71+
fi
72+
if [[ "$TARGET_LOWER" == *"openshift"* ]]; then
73+
RUN_OPENSHIFT=true
74+
fi
75+
if [[ "$TARGET_LOWER" == *"certified"* ]]; then
76+
RUN_CERTIFIED=true
77+
fi
78+
79+
if [ "$RUN_COMMUNITY" = false ] && [ "$RUN_OPENSHIFT" = false ] && [ "$RUN_CERTIFIED" = false ]; then
80+
echo "Error: Invalid argument '$TARGET'."
81+
echo "Argument must be 'all' or contain 'community', 'openshift', or 'certified'."
82+
exit 1
83+
fi
84+
fi
85+
86+
# Execute the functions based on flags
87+
if [ "$RUN_COMMUNITY" = true ]; then
88+
reset_community
89+
fi
90+
91+
if [ "$RUN_OPENSHIFT" = true ]; then
92+
reset_openshift
93+
fi
94+
95+
if [ "$RUN_CERTIFIED" = true ]; then
96+
reset_certified
97+
fi
98+

0 commit comments

Comments
 (0)