Skip to content

Commit a1aff1a

Browse files
authored
Merge pull request #116 from raffaelespazzoli/disconnected-install
added support for disconnected installation
2 parents b2b6048 + c165ab1 commit a1aff1a

File tree

3 files changed

+38
-25
lines changed

3 files changed

+38
-25
lines changed

.github/workflows/push.yaml

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
uses: actions/setup-go@v2
2323
with:
2424
go-version: ^1.16
25+
2526
- name: Check out code into the Go module directory
2627
uses: actions/checkout@v2
2728

@@ -48,8 +49,6 @@ jobs:
4849
export SEMVER_COMPLIANT=$(echo ${TAG:1} | egrep '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-])(?:\.(?:0|[1-9]\d|\d*[a-zA-Z-][0-9a-zA-Z-]))))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$')
4950
if [ -z "$SEMVER_COMPLIANT" ]; then echo "invalid semver tag ${GITHUB_REF/refs\/tags\//}"; exit 1; fi
5051
51-
52-
5352
- name: Get the version for merge
5453
id: get_version2
5554
if: "! startsWith(github.ref, 'refs/tags')"
@@ -72,12 +71,6 @@ jobs:
7271
shell: bash
7372
run: operator-sdk bundle validate ./bundle --select-optional name=operatorhub
7473

75-
- name: process bundle for disconnected support
76-
uses: redhat-cop/github-actions/disconnected-csv@master
77-
with:
78-
CSV_FILE: bundle/manifests/namespace-configuration-operator.clusterserviceversion.yaml
79-
TAGS_TO_DIGESTS: ${OPERATOR_IMAGE_TAG}
80-
8174
- name: build chart
8275
shell: bash
8376
run: make helmchart VERSION=${BUNDLE_VERSION} IMG=quay.io/${{ github.repository_owner }}/$(basename $GITHUB_REPOSITORY):${OPERATOR_IMAGE_TAG}
@@ -87,7 +80,7 @@ jobs:
8780

8881
- name: Set up Docker Buildx
8982
uses: docker/setup-buildx-action@v1
90-
83+
9184
- name: Login to DockerHub
9285
uses: docker/login-action@v1
9386
with:
@@ -114,7 +107,13 @@ jobs:
114107
- name: "Verify bundle image"
115108
shell: bash
116109
run: operator-sdk bundle validate quay.io/${{ github.repository_owner }}/$(basename $GITHUB_REPOSITORY)-bundle:${BUNDLE_IMAGE_TAG} --select-optional name=operatorhub
117-
110+
111+
- name: process bundle for disconnected support
112+
uses: redhat-cop/github-actions/disconnected-csv@master
113+
with:
114+
CSV_FILE: bundle/manifests/${{ env.REPOSITORY_NAME }}.clusterserviceversion.yaml
115+
TAGS_TO_DIGESTS: ${OPERATOR_IMAGE_TAG}
116+
118117
release-helm-chart:
119118
name: Helm Chart Release
120119
runs-on: ubuntu-latest
@@ -168,11 +167,13 @@ jobs:
168167
169168
- name: Checkout
170169
uses: actions/checkout@v2
170+
171171
- run: |
172172
git fetch --prune --unshallow
173173
- name: Get the version
174174
id: get_version
175175
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
176+
176177
- name: Generate Changelog
177178
run: |
178179
LATEST_TAG=$(git tag --sort=creatordate | sed '$!d')
@@ -184,6 +185,7 @@ jobs:
184185
fi
185186
git log --pretty=format:"- %s %H (%aN)" --no-merges ${REV_RANGE} > ${VERSION}-CHANGELOG.txt
186187
cat ${VERSION}-CHANGELOG.txt
188+
187189
- name: Create Release
188190
uses: softprops/action-gh-release@v1
189191
with:
@@ -204,13 +206,16 @@ jobs:
204206
shell: bash
205207
run: |
206208
echo "REPOSITORY_NAME=$(basename $GITHUB_REPOSITORY)" >> $GITHUB_ENV
209+
echo "CONTEXT_PATH="
207210
208211
- name: Checkout
209212
uses: actions/checkout@v2
213+
210214
- name: Set up Go 1.x
211215
uses: actions/setup-go@v2
212216
with:
213217
go-version: ^1.16
218+
214219
- name: Download operator sdk
215220
shell: bash
216221
env:
@@ -221,46 +226,53 @@ jobs:
221226
mkdir ${HOME}/bin
222227
mv operator-sdk_linux_amd64 ${HOME}/bin/operator-sdk
223228
echo "${HOME}/bin" >> $GITHUB_PATH
229+
224230
- name: Get the version
225231
id: get_version
226232
run: |
227233
export TAG=${GITHUB_REF/refs\/tags\//}
228234
echo "VERSION=${TAG:1}" >> $GITHUB_ENV
229-
- name: checkout community-operators
235+
236+
- name: checkout community-operators-prod
230237
uses: actions/checkout@v2
231238
with:
232-
repository: operator-framework/community-operators
233-
path: ./tmp/community-operators
239+
repository: redhat-openshift-ecosystem/community-operators-prod
240+
path: ./tmp/community-operators-prod
234241

235242
- name: check whether it is first release
236243
shell: bash
237244
run: |
238-
echo first_release=$([[ ! -d "./tmp/community-operators/community-operators/$(basename $GITHUB_REPOSITORY)" ]] && echo 'true' || echo 'false') >> $GITHUB_ENV
245+
echo first_release=$([[ ! -d "./tmp/community-operators-prod/operators/$(basename $GITHUB_REPOSITORY)" ]] && echo 'true' || echo 'false') >> $GITHUB_ENV
239246
echo $first_release
240-
241247
242248
- name: create and copy bundle to community operators
243249
shell: bash
244250
run: |
245251
make bundle IMG=quay.io/${{ github.repository_owner }}/$(basename $GITHUB_REPOSITORY):v${VERSION} VERSION=${VERSION} DEFAULT_CHANNEL=alpha
246252
sed 's/bundle\///g' bundle.Dockerfile > bundle/Dockerfile
247253
sed -i '/replaces: '"$(basename $GITHUB_REPOSITORY)"'/d' ./bundle/manifests/$(basename $GITHUB_REPOSITORY).clusterserviceversion.yaml
248-
mkdir -p ./tmp/community-operators/community-operators/$(basename $GITHUB_REPOSITORY)/${VERSION}
249-
/bin/cp -v -R ./bundle/* ./tmp/community-operators/community-operators/$(basename $GITHUB_REPOSITORY)/${VERSION}
250-
/bin/cp -v -R ./config/community-operators/* ./tmp/community-operators/community-operators/$(basename $GITHUB_REPOSITORY)
254+
mkdir -p ./tmp/community-operators-prod/operators/$(basename $GITHUB_REPOSITORY)/${VERSION}
255+
/bin/cp -v -R ./bundle/* ./tmp/community-operators-prod/operators/$(basename $GITHUB_REPOSITORY)/${VERSION}
256+
/bin/cp -v -R ./config/community-operators/* ./tmp/community-operators-prod/operators/$(basename $GITHUB_REPOSITORY)
257+
258+
- name: process bundle for disconnected support
259+
uses: redhat-cop/github-actions/disconnected-csv@master
260+
with:
261+
CSV_FILE: "./tmp/community-operators-prod/operators/${{ env.REPOSITORY_NAME }}/${{ env.VERSION }}/manifests/${{ env.REPOSITORY_NAME }}.clusterserviceversion.yaml"
262+
TAGS_TO_DIGESTS: ${OPERATOR_IMAGE_TAG}
251263

252264
- name: Create Pull Request
253265
uses: peter-evans/create-pull-request@v3
254266
if: ${{ startsWith( env.first_release, 'true' ) }}
255267
with:
256-
path: ./tmp/community-operators
268+
path: ./tmp/community-operators-prod
257269
commit-message: ${{ env.REPOSITORY_NAME }} release ${{ env.VERSION }}
258270
committer: ${{ github.actor }} <[email protected]>
259271
author: ${{ github.actor }} <[email protected]>
260272
signoff: true
261273
branch: ${{ env.REPOSITORY_NAME }}-${{ env.VERSION }}
262274
delete-branch: true
263-
push-to-fork: ${{ github.repository_owner }}/community-operators
275+
push-to-fork: ${{ github.repository_owner }}/community-operators-prod
264276
title: ${{ env.REPOSITORY_NAME }} initial commit
265277
body: |
266278
### New Submissions
@@ -317,14 +329,14 @@ jobs:
317329
uses: peter-evans/create-pull-request@v3
318330
if: ${{ ! startsWith( env.first_release, 'true' ) }}
319331
with:
320-
path: ./tmp/community-operators
332+
path: ./tmp/community-operators-prod
321333
commit-message: ${{ env.REPOSITORY_NAME }} release ${{ env.VERSION }}
322334
committer: ${{ github.actor }} <[email protected]>
323335
author: ${{ github.actor }} <[email protected]>
324336
signoff: true
325337
branch: ${{ env.REPOSITORY_NAME }}-${{ env.VERSION }}
326338
delete-branch: true
327-
push-to-fork: ${{ github.repository_owner }}/community-operators
339+
push-to-fork: ${{ github.repository_owner }}/community-operators-prod
328340
title: ${{ env.REPOSITORY_NAME }} new version ${{ env.VERSION }}
329341
body: |
330342
### New Submissions
@@ -375,6 +387,4 @@ jobs:
375387
<sup>1</sup> If you feel your Operator does not fit any of the pre-defined categories, file a PR against this repo and explain your need
376388
377389
<sup>2</sup> For more information see [here](https://github.com/operator-framework/operator-sdk/blob/master/doc/images/operator-capability-level.svg)
378-
token: ${{ secrets.COMMUNITY_OPERATOR_PAT }}
379-
380-
390+
token: ${{ secrets.COMMUNITY_OPERATOR_PAT }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ It is recommended to deploy this operator via [`OperatorHub`](https://operatorhu
192192

193193
### Deploying from OperatorHub
194194

195+
> **Note**: This operator supports being installed disconnected environments
196+
195197
If you want to utilize the Operator Lifecycle Manager (OLM) to install this operator, you can do so in two ways: from the UI or the CLI.
196198

197199
#### Deploying from OperatorHub UI

config/manifests/bases/namespace-configuration-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ metadata:
1313
operatorframework.io/suggested-namespace: namespace-configuration-operator
1414
repository: https://github.com/redhat-cop/namespace-configuration-operator
1515
support: Best Effort
16+
operators.openshift.io/infrastructure-features: '["Disconnected"]'
1617
name: namespace-configuration-operator.v0.0.0
1718
namespace: placeholder
1819
spec:

0 commit comments

Comments
 (0)