-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from alicerum/bundle-operator
github actions workflows for bundle and operator images
- Loading branch information
Showing
13 changed files
with
194 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
on: | ||
pull_request: | ||
branches: [ main ] | ||
push: | ||
branches: [ main ] | ||
name: ci/github | ||
jobs: | ||
checksecret: | ||
name: Check if REGISTRY_USERNAME is set in github secrets | ||
runs-on: ubuntu-latest | ||
outputs: | ||
is_registry_username_set: ${{ steps.checksecret_job.outputs.is_registry_username_set }} | ||
steps: | ||
- name: Check if REGISTRY_USERNAME is set | ||
id: checksecret_job | ||
env: | ||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} | ||
run: | | ||
echo "is_registry_username_set: ${{ env.REGISTRY_USERNAME != '' }}" | ||
echo "::set-output name=is_registry_username_set::${{ env.REGISTRY_USERNAME != '' }}" | ||
bundle-build: | ||
needs: [ checksecret ] | ||
if: needs.checksecret.outputs.is_registry_username_set == 'true' | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go-version: [ 1.16.x ] | ||
os: [ ubuntu-latest ] | ||
kubernetes: | ||
- v1.20.7 | ||
max-parallel: 2 | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Check out Code | ||
uses: actions/checkout@v2 | ||
- name: Install kubectl | ||
uses: azure/setup-kubectl@v1 | ||
with: | ||
version: ${{ matrix.kubernetes }} | ||
- name: Create kind cluster | ||
uses: helm/[email protected] | ||
with: | ||
version: v0.10.0 | ||
node_image: kindest/node:${{ matrix.kubernetes }} | ||
cluster_name: kind | ||
wait: 120s | ||
- name: Verify kind cluster | ||
run: | | ||
echo "# Using KinD context..." | ||
kubectl config use-context "kind-kind" | ||
echo "# KinD nodes:" | ||
kubectl get nodes | ||
- name: Login to the docker registry | ||
env: | ||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} | ||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} | ||
run: echo "$REGISTRY_PASSWORD" | docker login --username "$REGISTRY_USERNAME" --password-stdin quay.io | ||
- name: Make and push Operator image | ||
env: | ||
IMAGE_REPO: quay.io/shipwright | ||
TAG: pr-${{ github.event.number }} | ||
run: | | ||
make ko-publish IMAGE_REPO=ko.local | ||
docker tag ko.local/operator:${TAG} $IMAGE_REPO/operator-pr:${TAG} | ||
docker push $IMAGE_REPO/operator-pr:${TAG} | ||
- name: Make and push Bundle image | ||
env: | ||
IMAGE_REPO: quay.io/shipwright | ||
TAG: pr-${{ github.event.number }} | ||
BUNDLE_IMG_NAME: operator-bundle-pr | ||
OPERATOR_IMG_NAME: operator-pr | ||
run: | | ||
make bundle-push | ||
- name: Install OLM | ||
run: ./bin/operator-sdk olm install | ||
- name: Deploy Operator Bundle Image via subscription | ||
env: | ||
TAG: pr-${{ github.event.number }} | ||
run: | | ||
./bin/operator-sdk run bundle \ | ||
quay.io/shipwright/operator-bundle-pr:$TAG \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release: | ||
description: 'Desired tag' | ||
required: true | ||
tags: | ||
description: 'Previous tag' | ||
required: true | ||
|
||
jobs: | ||
release: | ||
if: ${{ github.repository == 'shipwright-io/operator' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
|
||
- name: Login to docker | ||
env: | ||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} | ||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} | ||
run: | | ||
echo "$REGISTRY_PASSWORD" | docker login --username "$REGISTRY_USERNAME" --password-stdin | ||
- name: Build and upload Operator Image | ||
env: | ||
VERSION: ${{ github.events.input.release }} | ||
run: | | ||
make ko-publish | ||
- name: Build and upload Operator Bundle Image | ||
env: | ||
VERSION: ${{ github.events.input.release }} | ||
run: | | ||
make bundle-push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
FROM scratch | ||
|
||
# Core bundle labels. | ||
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1 | ||
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/ | ||
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/ | ||
LABEL operators.operatorframework.io.bundle.package.v1=operator | ||
LABEL operators.operatorframework.io.bundle.channels.v1=alpha | ||
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.4.2 | ||
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.9.0+git | ||
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 | ||
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3 | ||
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ | ||
|
||
# Labels for testing. | ||
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 | ||
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ | ||
|
||
# Copy files to locations specified by labels. | ||
COPY bundle/manifests /manifests/ | ||
COPY bundle/metadata /metadata/ | ||
COPY bundle/tests/scorecard /tests/scorecard/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
annotations: | ||
operators.operatorframework.io.bundle.channels.v1: alpha | ||
operators.operatorframework.io.bundle.manifests.v1: manifests/ | ||
# Core bundle annotations. | ||
operators.operatorframework.io.bundle.mediatype.v1: registry+v1 | ||
operators.operatorframework.io.bundle.manifests.v1: manifests/ | ||
operators.operatorframework.io.bundle.metadata.v1: metadata/ | ||
operators.operatorframework.io.bundle.package.v1: operator | ||
operators.operatorframework.io.metrics.builder: operator-sdk-v1.4.2 | ||
operators.operatorframework.io.bundle.channels.v1: alpha | ||
operators.operatorframework.io.metrics.builder: operator-sdk-v1.9.0+git | ||
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1 | ||
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3 | ||
operators.operatorframework.io.test.config.v1: tests/scorecard/ | ||
|
||
# Annotations for testing. | ||
operators.operatorframework.io.test.mediatype.v1: scorecard+v1 | ||
operators.operatorframework.io.test.config.v1: tests/scorecard/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters