Skip to content

Commit f1a67d3

Browse files
committed
CLOUDP-362278: Fix RH script bundle/test copy
1 parent d5780ac commit f1a67d3

File tree

3 files changed

+98
-2
lines changed

3 files changed

+98
-2
lines changed

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: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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+
# Check if an argument is provided
17+
if [ -z "$1" ]; then
18+
echo "Error: No target specified."
19+
echo "Usage: $0 [all | <target_string>]"
20+
echo " all : Resets community, openshift, and certified operators."
21+
echo " <target_string> : Resets specific operators if the string contains:"
22+
echo " 'community', 'openshift', or 'certified'."
23+
echo "Example: $0 'community certified' (resets both)"
24+
exit 1
25+
fi
26+
27+
TARGET="$1"
28+
29+
function reset_community() {
30+
echo "Remove prev version branch locally and remotely"
31+
pushd "${RH_COMMUNITY_OPERATORHUB_REPO_PATH}"
32+
git checkout main
33+
git branch -D "mongodb-atlas-operator-community-${VERSION}"
34+
git push origin ":mongodb-atlas-operator-community-${VERSION}"
35+
popd
36+
}
37+
38+
function reset_openshift() {
39+
echo "Remove prev version branch locally and remotely"
40+
pushd "${RH_COMMUNITY_OPENSHIFT_REPO_PATH}"
41+
git checkout main
42+
git branch -D "mongodb-atlas-operator-community-${VERSION}"
43+
git push origin ":mongodb-atlas-operator-community-${VERSION}"
44+
popd
45+
}
46+
47+
function reset_certified() {
48+
echo "Remove prev version branch locally and remotely"
49+
pushd "${RH_CERTIFIED_OPENSHIFT_REPO_PATH}"
50+
git checkout main
51+
git branch -D "mongodb-atlas-kubernetes-operator-${VERSION}"
52+
git push origin ":mongodb-atlas-kubernetes-operator-${VERSION}"
53+
popd
54+
}
55+
56+
TARGET_LOWER=$(echo "$TARGET" | tr '[:upper:]' '[:lower:]')
57+
58+
RUN_COMMUNITY=false
59+
RUN_OPENSHIFT=false
60+
RUN_CERTIFIED=false
61+
62+
if [[ "$TARGET_LOWER" == "all" ]]; then
63+
RUN_COMMUNITY=true
64+
RUN_OPENSHIFT=true
65+
RUN_CERTIFIED=true
66+
else
67+
if [[ "$TARGET_LOWER" == *"community"* ]]; then
68+
RUN_COMMUNITY=true
69+
fi
70+
if [[ "$TARGET_LOWER" == *"openshift"* ]]; then
71+
RUN_OPENSHIFT=true
72+
fi
73+
if [[ "$TARGET_LOWER" == *"certified"* ]]; then
74+
RUN_CERTIFIED=true
75+
fi
76+
77+
if [ "$RUN_COMMUNITY" = false ] && [ "$RUN_OPENSHIFT" = false ] && [ "$RUN_CERTIFIED" = false ]; then
78+
echo "Error: Invalid argument '$TARGET'."
79+
echo "Argument must be 'all' or contain 'community', 'openshift', or 'certified'."
80+
exit 1
81+
fi
82+
fi
83+
84+
# Execute the functions based on flags
85+
if [ "$RUN_COMMUNITY" = true ]; then
86+
reset_community
87+
fi
88+
89+
if [ "$RUN_OPENSHIFT" = true ]; then
90+
reset_openshift
91+
fi
92+
93+
if [ "$RUN_CERTIFIED" = true ]; then
94+
reset_certified
95+
fi
96+

0 commit comments

Comments
 (0)