Skip to content

Commit

Permalink
Merge pull request #47 from redhat-marketplace/release/0.2.0
Browse files Browse the repository at this point in the history
Release 0.2.0
  • Loading branch information
zach-source authored Jul 20, 2020
2 parents afa5121 + de2f0c3 commit 5ce2561
Show file tree
Hide file tree
Showing 48 changed files with 3,840 additions and 2,685 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,27 @@ jobs:
version:
name: Bump Version
runs-on: ubuntu-latest
strategy:
matrix:
registry:
- 'quay.io/rh-marketplace'
include:
- registry: quay.io/rh-marketplace
name: quay
key: quayUser
value: quayPassword
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
id: go

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

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

Expand All @@ -30,9 +44,43 @@ jobs:
if [ "$RESULT" != "" ] ; then
NEWVERSION=$(make bump-version)
echo "bumping $VERSION to $NEWVERSION"
git config user.name 'RHM Oper Bot'
git config user.email '[email protected]'
git add version/version.go
git commit -m "chore: bumping version from $VERSION to $NEWVERSION"
git push
echo ::set-env name=bump::true
else
echo "$VERSION is already bumped" ;
fi
- name: Install operator-sdk
if: env.bump == 'true'
run: |
cd /tmp
curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
python -m pip install --upgrade pip
pip3 install -Iv operator-courier==$COURIER_VERSION
curl -LO https://github.com/operator-framework/operator-registry/releases/download/${OPM_VERSION}/linux-amd64-opm
chmod +x linux-amd64-opm && sudo cp linux-amd64-opm /usr/local/bin/opm && rm linux-amd64-opm
echo "::add-path::/usr/local/bin"
sudo apt-get install -y sed
sudo snap install yq
env:
RELEASE_VERSION: v0.18.0
OPM_VERSION: v1.12.5
COURIER_VERSION: 2.1.7

- name: Login ${{ matrix.name }}
if: env.bump == 'true'
run: make docker-login
env:
DOCKER_USER: ${{ secrets[matrix.key] }}
DOCKER_PASSWORD: ${{ secrets[matrix.value] }}
REGISTRY: ${{ matrix.registry }}

- name: Build all bundles
if: env.bump == 'true'
run: |
make opm-bundle-all
57 changes: 57 additions & 0 deletions .github/workflows/create-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Create Branch

on:
push:
branches:
- 'release/**'
- 'hotfix/**'

jobs:
create-bundle:
name: Create Manifest
runs-on: ubuntu-latest
strategy:
matrix:
channel: ['stable']
include:
- channel: 'stable'
tags: ['release']
draft: 'false'
message: 'Stable release should be merged.'
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
id: go

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
token: ${{ secrets.pullRequestSecret }}

- name: Get Vars
id: vars
run: |
echo ::set-env name=pr_branch::$(echo $BRANCH | sed 's/refs\/heads\///')
echo "::set-output name=version::$(make current-version)"
echo "::set-output name=tag::sha-$(git rev-parse --short HEAD)"
echo "::set-output name=hash::$(make current-version)-${FILEHASH:0:6}"
echo "::set-env name=OPERATOR_IMAGE::quay.io/rh-marketplace/redhat-marketplace-operator:$(make current-version)-${FILEHASH:0:6}"
env:
FILEHASH: ${{ hashFiles('build/**', 'assets/**', 'cmd/**', 'pkg/**', 'version/**', 'go.sum', 'go.mod') }}
BRANCH: ${{ github.ref }}

- name: Open a PR to the default branch
uses: vsoch/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.pullRequestSecret }}
PULL_REQUEST_FROM_BRANCH: '${{ env.pr_branch }}'
PULL_REQUEST_BRANCH: master
PULL_REQUEST_TITLE: 'Release ${{ steps.vars.outputs.version }}'
PULL_REQUEST_BODY: "Release PR - merge when ready.\n\nSteps:\n1. Release the beta channel bundle from the PR 'Generate Bundle' check.\n1. Test beta. Make changes to release branch as necessary.\n1. Release the stable channel.\n1. Merge this PR."
20 changes: 8 additions & 12 deletions .github/workflows/create-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,16 @@ jobs:
curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
python -m pip install --upgrade pip
pip3 install operator-courier
pip3 install -Iv operator-courier==$COURIER_VERSION
curl -LO https://github.com/operator-framework/operator-registry/releases/download/${OPM_VERSION}/linux-amd64-opm
chmod +x linux-amd64-opm && sudo cp linux-amd64-opm /usr/local/bin/opm && rm linux-amd64-opm
echo "::add-path::/usr/local/bin"
sudo apt-get install -y sed
sudo snap install yq
env:
RELEASE_VERSION: v0.18.0
OPM_VERSION: v1.12.5
COURIER_VERSION: 2.1.7

- name: Create CSV
id: bundle
Expand All @@ -69,20 +75,10 @@ jobs:
CSV_CHANNEL: ${{ matrix.channel }}
CSV_DEFAULT_CHANNEL: ${{ matrix.channel == 'stable' }}

- name: Create branch
if: ${{ matrix.channel == 'stable' && github.event_name == 'push' }}
- name: Create commit
run: |
git config user.name 'RHM Oper Bot'
git config user.email '[email protected]'
git add ./deploy/olm-catalog
git commit -m "chore: update csv"
git push
- name: Open a PR to the default branch
uses: vsoch/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.pullRequestSecret }}
PULL_REQUEST_FROM_BRANCH: '${{ env.pr_branch }}'
PULL_REQUEST_BRANCH: master
PULL_REQUEST_TITLE: 'Release ${{ steps.vars.outputs.version }}'
PULL_REQUEST_BODY: "Release PR - merge when ready.\n\nSteps:\n1. Release the beta channel bundle from the PR 'Generate Bundle' check.\n1. Test beta. Make changes to release branch as necessary.\n1. Release the stable channel.\n1. Merge this PR."
9 changes: 6 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ jobs:
curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
python -m pip install --upgrade pip
pip3 install operator-courier
pip3 install -Iv operator-courier==$COURIER_VERSION
curl -LO https://github.com/operator-framework/operator-registry/releases/download/${OPM_VERSION}/linux-amd64-opm
chmod +x linux-amd64-opm && sudo cp linux-amd64-opm /usr/local/bin/opm && rm linux-amd64-opm
echo "::add-path::/usr/local/bin"
Expand All @@ -194,6 +194,7 @@ jobs:
env:
RELEASE_VERSION: v0.18.0
OPM_VERSION: v1.12.5
COURIER_VERSION: 2.1.7

- name: Login ${{ matrix.name }}
run: make docker-login
Expand Down Expand Up @@ -264,6 +265,7 @@ jobs:
- 'marketplace.redhat.com_v1alpha1_meterbase_cr.yaml'
- 'marketplace.redhat.com_v1alpha1_meterdefinition_cr.yaml'
- 'marketplace.redhat.com_v1alpha1_razeedeployment_cr.yaml'
- 'marketplace.redhat.com_v1alpha1_remoteresources3_cr.yaml'
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
Expand Down Expand Up @@ -293,19 +295,20 @@ jobs:
curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
python -m pip install --upgrade pip
pip3 install operator-courier
pip3 install -Iv operator-courier==$COURIER_VERSION
sudo snap install yq
echo "::add-path::/usr/local/bin"
env:
RELEASE_VERSION: v0.18.0
COURIER_VERSION: 2.1.7

- name: Run scorecard for ${{ matrix.cr }}
shell: bash {0}
continue-on-error: true
run: |
echo "Updating osdk to version ${VERSION}"
make generate-csv
yq w .osdk-scorecard.yaml 'scorecard.plugins.*.*.csv-path' deploy/olm-catalog/redhat-marketplace-operator/${VERSION}/redhat-marketplace-operator.v${VERSION}.clusterserviceversion.yaml > .osdk-scorecard.yaml
yq w .osdk-scorecard.yaml.tpl 'scorecard.plugins.*.*.csv-path' deploy/olm-catalog/redhat-marketplace-operator/${VERSION}/redhat-marketplace-operator.v${VERSION}.clusterserviceversion.yaml > .osdk-scorecard.yaml
yq w -i .osdk-scorecard.yaml 'scorecard.plugins.*.*.cr-manifest.+' deploy/crds/${{ matrix.cr }}
./scripts/scorecard.sh
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/generate-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ jobs:
curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
python -m pip install --upgrade pip
pip3 install operator-courier
pip3 install -Iv operator-courier==$COURIER_VERSION
echo "::add-path::/usr/local/bin"
env:
RELEASE_VERSION: v0.18.0
COURIER_VERSION: 2.1.7

- name: Create Bundle
id: bundle
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,10 @@ bundle/
cache/
scorecard-output.json
.env-prod

.sa.config

deploy/operator.yaml
deploy/role.yaml
deploy/role_binding.yaml
deploy/service_account.yaml
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ generate-bundle: ## Generate the csv
@go run github.com/mikefarah/yq/v3 d -i $(MANIFEST_CSV_FILE) 'spec.install.spec.deployments[*].spec.template.spec.containers[*].env(name==WATCH_NAMESPACE).valueFrom'
@go run github.com/mikefarah/yq/v3 w -i $(MANIFEST_CSV_FILE) 'spec.install.spec.deployments[*].spec.template.spec.containers[*].env(name==WATCH_NAMESPACE).value' ''

INTERNAL_CRDS='["razeedeployments.marketplace.redhat.com","meterbases.marketplace.redhat.com","meterdefinitions.marketplace.redhat.com","remoteresources3s.marketplace.redhat.com"]'

generate-csv: ## Generate the csv
make helm
operator-sdk generate csv \
Expand All @@ -79,6 +81,7 @@ generate-csv: ## Generate the csv
--make-manifests=false
@go run github.com/mikefarah/yq/v3 w -i $(VERSION_CSV_FILE) 'metadata.annotations.containerImage' $(OPERATOR_IMAGE)
@go run github.com/mikefarah/yq/v3 w -i $(VERSION_CSV_FILE) 'metadata.annotations.createdAt' $(CREATED_TIME)
@go run github.com/mikefarah/yq/v3 w -i $(VERSION_CSV_FILE) 'metadata.annotations."operators.operatorframework.io/internal-objects"' $(INTERNAL_CRDS)
@go run github.com/mikefarah/yq/v3 d -i $(VERSION_CSV_FILE) 'spec.install.spec.deployments[*].spec.template.spec.containers[*].env(name==WATCH_NAMESPACE).valueFrom'
@go run github.com/mikefarah/yq/v3 w -i $(VERSION_CSV_FILE) 'spec.install.spec.deployments[*].spec.template.spec.containers[*].env(name==WATCH_NAMESPACE).value' ''

Expand Down Expand Up @@ -164,6 +167,7 @@ create: ##creates the required crds for this deployment
- kubectl apply -f deploy/crds/marketplace.redhat.com_razeedeployments_crd.yaml -n ${NAMESPACE}
- kubectl apply -f deploy/crds/marketplace.redhat.com_meterbases_crd.yaml -n ${NAMESPACE}
- kubectl apply -f deploy/crds/marketplace.redhat.com_meterdefinitions_crd.yaml -n ${NAMESPACE}
- kubectl apply -f deploy/crds/marketplace.redhat.com_remoteresources3s_crd.yaml -n ${NAMESPACE}

deploys: ##deploys the resources for deployment
@echo deploying services and operators
Expand All @@ -175,6 +179,15 @@ deploy-services: ##deploys the service acconts, roles, and role bindings
- kubectl create -f deploy/role.yaml --namespace=${NAMESPACE}
- kubectl create -f deploy/role_binding.yaml --namespace=${NAMESPACE}

migrate: ##used to simulate migrating to the latest version of the operator
- make helm
- kubectl apply -f deploy/operator.yaml -n ${NAMESPACE}
- kubectl apply -f deploy/role_binding.yaml -n ${NAMESPACE}
- kubectl apply -f deploy/role.yaml -n ${NAMESPACE}
- kubectl apply -f deploy/service_account.yaml -n ${NAMESPACE}
- make create
- kubectl apply -f deploy/operator.yaml --namespace=${NAMESPACE}

apply: ##applies changes to crds
- kubectl apply -f deploy/crds/marketplace.redhat.com_v1alpha1_marketplaceconfig_cr.yaml --namespace=${NAMESPACE}

Expand All @@ -193,9 +206,14 @@ delete: ##delete the contents created in 'make create'
- kubectl delete -f deploy/role.yaml -n ${NAMESPACE}
- kubectl delete -f deploy/service_account.yaml -n ${NAMESPACE}
- kubectl delete -f deploy/crds/marketplace.redhat.com_marketplaceconfigs_crd.yaml
- kubectl patch Razeedeployment rhm-marketplaceconfig-razeedeployment -p '{"metadata":{"finalizers":[]}}' --type=merge
- kubectl delete -f deploy/crds/marketplace.redhat.com_razeedeployments_crd.yaml
- kubectl delete -f deploy/crds/marketplace.redhat.com_meterbases_crd.yaml
- kubectl delete -f deploy/crds/marketplace.redhat.com_meterdefinitions_crd.yaml
- kubectl patch remoteresources3s.marketplace.redhat.com parent -p '{"metadata":{"finalizers":[]}}' --type=merge
- kubectl patch remoteresources3s.marketplace.redhat.com child -p '{"metadata":{"finalizers":[]}}' --type=merge
- kubectl patch customresourcedefinition.apiextensions.k8s.io remoteresources3s.marketplace.redhat.com -p '{"metadata":{"finalizers":[]}}' --type=merge
- kubectl delete -f deploy/crds/marketplace.redhat.com_remoteresources3s_crd.yaml -n ${NAMESPACE}
- kubectl delete namespace ${NAMESPACE}

delete-razee: ##delete the razee CR
Expand Down
2 changes: 2 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func makeMarketplaceController(
razeeC *controller.RazeeDeployController,
olmSubscriptionC *controller.OlmSubscriptionController,
olmClusterServiceVersionC *controller.OlmClusterServiceVersionController,
remoteResourceS3C *controller.RemoteResourceS3Controller,
nodeC *controller.NodeController,
controllerFlags *controller.ControllerFlagSet,
opsSrcScheme *managers.OpsSrcSchemeDefinition,
Expand All @@ -56,6 +57,7 @@ func makeMarketplaceController(
(*controller.ControllerDefinition)(olmSubscriptionC),
(*controller.ControllerDefinition)(olmClusterServiceVersionC),
(*controller.ControllerDefinition)(nodeC),
(*controller.ControllerDefinition)(remoteResourceS3C),
},
Schemes: []*managers.SchemeDefinition{
(*managers.SchemeDefinition)(monitoringScheme),
Expand Down
3 changes: 2 additions & 1 deletion cmd/manager/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5ce2561

Please sign in to comment.