Skip to content

Commit

Permalink
added support for disconnected installation
Browse files Browse the repository at this point in the history
migrated to new operatro hub prod repo

Signed-off-by: raffaelespazzoli <raffaele.spazzoli@gmail.com>
  • Loading branch information
raffaelespazzoli committed Aug 11, 2021
1 parent ae7127d commit 783e8c1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
54 changes: 35 additions & 19 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: ^1.16

- name: Check out code into the Go module directory
uses: actions/checkout@v2

Expand All @@ -48,8 +49,6 @@ jobs:
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-]+)*))?$')
if [ -z "$SEMVER_COMPLIANT" ]; then echo "invalid semver tag ${GITHUB_REF/refs\/tags\//}"; exit 1; fi
- name: Get the version for merge
id: get_version2
if: "! startsWith(github.ref, 'refs/tags')"
Expand Down Expand Up @@ -81,7 +80,7 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand All @@ -108,7 +107,13 @@ jobs:
- name: "Verify bundle image"
shell: bash
run: operator-sdk bundle validate quay.io/${{ github.repository_owner }}/$(basename $GITHUB_REPOSITORY)-bundle:${BUNDLE_IMAGE_TAG} --select-optional name=operatorhub


- name: process bundle for disconnected support
uses: redhat-cop/github-actions/disconnected-csv@master
with:
CSV_FILE: bundle/manifests/${{ env.REPOSITORY_NAME }}.clusterserviceversion.yaml
TAGS_TO_DIGESTS: ${OPERATOR_IMAGE_TAG}

release-helm-chart:
name: Helm Chart Release
runs-on: ubuntu-latest
Expand Down Expand Up @@ -162,11 +167,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- run: |
git fetch --prune --unshallow
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

- name: Generate Changelog
run: |
LATEST_TAG=$(git tag --sort=creatordate | sed '$!d')
Expand All @@ -178,6 +185,7 @@ jobs:
fi
git log --pretty=format:"- %s %H (%aN)" --no-merges ${REV_RANGE} > ${VERSION}-CHANGELOG.txt
cat ${VERSION}-CHANGELOG.txt
- name: Create Release
uses: softprops/action-gh-release@v1
with:
Expand All @@ -198,13 +206,16 @@ jobs:
shell: bash
run: |
echo "REPOSITORY_NAME=$(basename $GITHUB_REPOSITORY)" >> $GITHUB_ENV
echo "CONTEXT_PATH="
- name: Checkout
uses: actions/checkout@v2

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.16

- name: Download operator sdk
shell: bash
env:
Expand All @@ -215,46 +226,53 @@ jobs:
mkdir ${HOME}/bin
mv operator-sdk_linux_amd64 ${HOME}/bin/operator-sdk
echo "${HOME}/bin" >> $GITHUB_PATH
- name: Get the version
id: get_version
run: |
export TAG=${GITHUB_REF/refs\/tags\//}
echo "VERSION=${TAG:1}" >> $GITHUB_ENV
- name: checkout community-operators
- name: checkout community-operators-prod
uses: actions/checkout@v2
with:
repository: operator-framework/community-operators
path: ./tmp/community-operators
repository: redhat-openshift-ecosystem/community-operators-prod
path: ./tmp/community-operators-prod

- name: check whether it is first release
shell: bash
run: |
echo first_release=$([[ ! -d "./tmp/community-operators/community-operators/$(basename $GITHUB_REPOSITORY)" ]] && echo 'true' || echo 'false') >> $GITHUB_ENV
echo first_release=$([[ ! -d "./tmp/community-operators-prod/operators/$(basename $GITHUB_REPOSITORY)" ]] && echo 'true' || echo 'false') >> $GITHUB_ENV
echo $first_release
- name: create and copy bundle to community operators
shell: bash
run: |
make bundle IMG=quay.io/${{ github.repository_owner }}/$(basename $GITHUB_REPOSITORY):v${VERSION} VERSION=${VERSION} DEFAULT_CHANNEL=alpha
sed 's/bundle\///g' bundle.Dockerfile > bundle/Dockerfile
sed -i '/replaces: '"$(basename $GITHUB_REPOSITORY)"'/d' ./bundle/manifests/$(basename $GITHUB_REPOSITORY).clusterserviceversion.yaml
mkdir -p ./tmp/community-operators/community-operators/$(basename $GITHUB_REPOSITORY)/${VERSION}
/bin/cp -v -R ./bundle/* ./tmp/community-operators/community-operators/$(basename $GITHUB_REPOSITORY)/${VERSION}
/bin/cp -v -R ./config/community-operators/* ./tmp/community-operators/community-operators/$(basename $GITHUB_REPOSITORY)
mkdir -p ./tmp/community-operators-prod/operators/$(basename $GITHUB_REPOSITORY)/${VERSION}
/bin/cp -v -R ./bundle/* ./tmp/community-operators-prod/operators/$(basename $GITHUB_REPOSITORY)/${VERSION}
/bin/cp -v -R ./config/community-operators/* ./tmp/community-operators-prod/operators/$(basename $GITHUB_REPOSITORY)
- name: process bundle for disconnected support
uses: redhat-cop/github-actions/disconnected-csv@master
with:
CSV_FILE: "./tmp/community-operators-prod/operators/${{ env.REPOSITORY_NAME }}/${{ env.VERSION }}/manifests/${{ env.REPOSITORY_NAME }}.clusterserviceversion.yaml"
TAGS_TO_DIGESTS: ${OPERATOR_IMAGE_TAG}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
if: ${{ startsWith( env.first_release, 'true' ) }}
with:
path: ./tmp/community-operators
path: ./tmp/community-operators-prod
commit-message: ${{ env.REPOSITORY_NAME }} release ${{ env.VERSION }}
committer: ${{ github.actor }} <raffaele.spazzoli@gmail.com>
author: ${{ github.actor }} <raffaele.spazzoli@gmail.com>
signoff: true
branch: ${{ env.REPOSITORY_NAME }}-${{ env.VERSION }}
delete-branch: true
push-to-fork: ${{ github.repository_owner }}/community-operators
push-to-fork: ${{ github.repository_owner }}/community-operators-prod
title: ${{ env.REPOSITORY_NAME }} initial commit
body: |
### New Submissions
Expand Down Expand Up @@ -311,14 +329,14 @@ jobs:
uses: peter-evans/create-pull-request@v3
if: ${{ ! startsWith( env.first_release, 'true' ) }}
with:
path: ./tmp/community-operators
path: ./tmp/community-operators-prod
commit-message: ${{ env.REPOSITORY_NAME }} release ${{ env.VERSION }}
committer: ${{ github.actor }} <raffaele.spazzoli@gmail.com>
author: ${{ github.actor }} <raffaele.spazzoli@gmail.com>
signoff: true
branch: ${{ env.REPOSITORY_NAME }}-${{ env.VERSION }}
delete-branch: true
push-to-fork: ${{ github.repository_owner }}/community-operators
push-to-fork: ${{ github.repository_owner }}/community-operators-prod
title: ${{ env.REPOSITORY_NAME }} new version ${{ env.VERSION }}
body: |
### New Submissions
Expand Down Expand Up @@ -369,6 +387,4 @@ jobs:
<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
<sup>2</sup> For more information see [here](https://github.com/operator-framework/operator-sdk/blob/master/doc/images/operator-capability-level.svg)
token: ${{ secrets.COMMUNITY_OPERATOR_PAT }}


token: ${{ secrets.COMMUNITY_OPERATOR_PAT }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ It is recommended to deploy this operator via [`OperatorHub`](https://operatorhu

### Deploying from OperatorHub

> **Note**: This operator supports being installed disconnected environments
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.

#### Deploying from OperatorHub UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v2
repository: https://github.com/redhat-cop/volume-expander-operator
support: Best Effort
operators.openshift.io/infrastructure-features: '["Disconnected"]'
name: volume-expander-operator.v0.1.0
namespace: placeholder
spec:
Expand Down

0 comments on commit 783e8c1

Please sign in to comment.