1+ name : Release Openshift
2+ on :
3+ workflow_dispatch :
4+ inputs :
5+ version :
6+ description : " Release version:"
7+ required : true
8+ jobs :
9+ release-openshift :
10+ name : " Create Pull request for openshift release"
11+ runs-on : ubuntu-latest
12+ env :
13+ GITHUB_TOKEN : ${{ github.token }}
14+ REPO_PATH : " operators/mongodb-atlas-kubernetes"
15+ strategy :
16+ matrix :
17+ repository : ["mongodb-forks/community-operators", "mongodb-forks/community-operators-prod", "mongodb-forks/certified-operators"]
18+ include :
19+ - repository : " mongodb-forks/certified-operators"
20+ certified : true
21+ steps :
22+ - name : Clone/Checkout Atlas Operator
23+ uses : actions/checkout@v3.1.0
24+ with :
25+ ref : main
26+ path : " mongodb-atlas-kubernetes"
27+ fetch-depth : 0
28+ - name : Clone/Checkout releases repositories
29+ uses : actions/checkout@v3.1.0
30+ with :
31+ repository : ${{ matrix.repository }}
32+ ref : main
33+ path : ${{ matrix.repository }}
34+ token : ${{ github.token }}
35+ - name : Prepare version
36+ env :
37+ VERSION : ${{ github.event.inputs.version }}
38+ REPOSITORY : ${{ matrix.repository }}
39+ run : |
40+ cd $REPOSITORY
41+ mkdir -p "${REPO_PATH}/${VERSION}"
42+
43+ cd ../../mongodb-atlas-kubernetes
44+ cp -r bundle.Dockerfile bundle/manifests bundle/metadata bundle/tests "../${REPOSITORY}/${REPO_PATH}/${VERSION}"
45+ - name : Configure non-certified release
46+ if : ${{ ! matrix.certified }}
47+ env :
48+ VERSION : ${{ github.event.inputs.version }}
49+ REPOSITORY : ${{ matrix.repository }}
50+ run : |
51+ echo "Configure non-certified release"
52+ cd "$REPOSITORY/$REPO_PATH"
53+ sed -i.bak 's/COPY bundle\/manifests/COPY manifests/' "${VERSION}/bundle.Dockerfile"
54+ sed -i.bak 's/COPY bundle\/metadata/COPY metadata/' "${VERSION}/bundle.Dockerfile"
55+ sed -i.bak 's/COPY bundle\/tests\/scorecard/COPY tests\/scorecard/' "${VERSION}/bundle.Dockerfile"
56+ rm "${VERSION}/bundle.Dockerfile.bak"
57+ - name : Certify Openshift images
58+ uses : ./.github/actions/certify-openshift-images
59+ with :
60+ repository : quay.io/mongodb/mongodb-atlas-kubernetes-operator
61+ version : ${{ github.event.inputs.version }}
62+ quay_password : ${{ secrets.QUAY_PASSWORD }}
63+ rhcc_token : ${{ secrets.RH_CERTIFICATION_PYXIS_API_TOKEN }}
64+ rhcc_project : ${{ secrets.RH_CERTIFICATION_OSPID }}
65+ - name : Configure certified release
66+ if : ${{ matrix.certified }}
67+ env :
68+ VERSION : ${{ github.event.inputs.version }}
69+ REPOSITORY : ${{ matrix.repository }}
70+ IMAGE : quay.io/mongodb/mongodb-atlas-kubernetes-operator
71+ run : |
72+ # Reference to image
73+ REPO_DIGEST=$(docker inspect --format='{{ index .RepoDigests 0}}' "${IMAGE}":"${VERSION}")
74+ containerImage="quay.io/${REPO_DIGEST}"
75+ yq e -i '.metadata.annotations.containerImage = env(containerImage)' "${VERSION}"/manifests/mongodb-atlas-kubernetes.clusterserviceversion.yaml
76+ yq e -i '.spec.install.spec.deployments[0].spec.template.spec.containers[0].image = env(containerImage)' "${VERSION}"/manifests/mongodb-atlas-kubernetes.clusterserviceversion.yaml
77+
78+ # Add skip range
79+ value='">=0.8.0"' yq e -i '.spec.skipRange = env(value)' "${VERSION}"/manifests/mongodb-atlas-kubernetes.clusterserviceversion.yaml
80+ - name : Push Changes & Open PR
81+ env :
82+ VERSION : ${{ github.event.inputs.version }}
83+ REPOSITORY : ${{ matrix.repository }}
84+ ASSIGNEES : priyolahiri,fabritsius,igor-karpukhin,sugar-pack,helderjs
85+ run : |
86+ cd "$REPOSITORY/$REPO_PATH"
87+
88+ # Sync fork
89+ gh auth setup-git
90+ gh repo sync -b main
91+
92+ # configure git user
93+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
94+ git config --global user.name "github-actions[bot]"
95+
96+ # commit, push
97+ git checkout -b "mongodb-atlas-operator-community-${VERSION}"
98+ git add "${VERSION}"
99+ git status
100+ git commit -m "MongoDB Atlas Operator ${VERSION}" --signoff
101+ git push origin "mongodb-atlas-operator-community-${VERSION}"
102+
103+ # open PR
104+ gh pr create \
105+ --title "operator mongodb-atlas-kubernetes (${VERSION})" \
106+ --assignee "${ASSIGNEES}"
0 commit comments