Skip to content

Commit ba6a3ad

Browse files
committed
Add composites
1 parent 0dfc4f8 commit ba6a3ad

File tree

6 files changed

+222
-0
lines changed

6 files changed

+222
-0
lines changed

.github/actions/bundle.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Bundle"
2+
description: "Build & push Operator bundle"
3+
inputs:
4+
TAG:
5+
description: Git action Tag
6+
required: true
7+
type: string
8+
9+
OPERATOR_SDK_VERSION:
10+
description: Operator SDK version to use
11+
default: "v1.32.0"
12+
required: false
13+
type: string
14+
15+
OPM_VERSION:
16+
description: OPM CLI version to use
17+
default: "v1.50.0"
18+
required: false
19+
type: string
20+
outputs:
21+
lint_status:
22+
description: 'The result of the linting step'
23+
runs:
24+
using: "composite"
25+
steps:
26+
- name: Install CLI tools from OpenShift Mirror
27+
uses: redhat-actions/openshift-tools-installer@v1
28+
with:
29+
source: "github"
30+
operator-sdk: ${{ inputs.OPERATOR_SDK_VERSION }}
31+
opm: ${{ inputs.OPM_VERSION }}
32+
33+
- name: Build and Push Bundle
34+
run: make bundle bundle-build bundle-push
35+
env:
36+
PR_TAG: -${{ inputs.TAG }}

.github/actions/catalog.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Catalog"
2+
description: "Build & push operator bundle"
3+
inputs:
4+
GOLANG_VERSION:
5+
description: Go version to use
6+
default: "~1.18"
7+
required: false
8+
type: string
9+
outputs:
10+
lint_status:
11+
description: 'The result of the linting step'
12+
runs:
13+
using: "composite"
14+
steps:
15+

.github/actions/docker.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Setup Docker"
2+
description: "Setup Docker repository"
3+
inputs:
4+
TAG:
5+
description: Git action Tag
6+
required: true
7+
type: string
8+
outputs:
9+
IMAGE_REPOSITORY:
10+
description: "The tag for the workflow run"
11+
value: ${{ steps.repository.outputs.IMAGE_REPOSITORY }}
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v3
17+
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
20+
with:
21+
driver-opts: image=moby/buildkit:v0.9.3
22+
buildkitd-flags: --debug
23+
24+
- name: Login to Registry
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ${{ secrets.CONTAINER_REGISTRY_URL }}
28+
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
29+
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
30+
31+
- name: Generate image repository path
32+
id: repository
33+
run: |
34+
echo IMAGE_REPOSITORY=$(echo ${{ secrets.CONTAINER_REGISTRY_URL }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT
35+
echo "IMAGE_REPOSITORY=${{ env.IMAGE_REPOSITORY }}" >> $GITHUB_OUTPUT

.github/actions/operator.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Operator"
2+
description: "Build and push operator image"
3+
inputs:
4+
GOLANG_VERSION:
5+
description: Go version to use
6+
default: "~1.18"
7+
required: false
8+
type: string
9+
10+
RUN_GOLANG_CI_LINT:
11+
description: Run golangci-lint
12+
default: true
13+
required: false
14+
type: boolean
15+
16+
GOLANG_CI_LINT_VERSION:
17+
description: golang-ci-lint version to use
18+
default: "v1.53.3"
19+
required: false
20+
type: string
21+
22+
RUN_GOLANG_TESTS:
23+
description: Run golang tests
24+
default: true
25+
required: false
26+
type: boolean
27+
28+
DOCKERFILE_PATH:
29+
description: Dockerfile path
30+
required: false
31+
default: Dockerfile
32+
type: string
33+
runs:
34+
using: "composite"
35+
steps:
36+

.github/actions/tag.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "Generate Tag"
2+
description: "Setup Docker"
3+
inputs:
4+
PR:
5+
description: Go version to use
6+
default: false
7+
required: false
8+
type: string
9+
10+
RELEASE_BRANCH:
11+
description: Release branch to push changes
12+
required: false
13+
default: main
14+
type: string
15+
outputs:
16+
TAG:
17+
description: "The tag for the workflow run"
18+
value: ${{ steps.tag.outputs.TAG }}
19+
runs:
20+
using: "composite"
21+
steps:
22+
- name: Generate Tag
23+
id: generate
24+
if: ${{ inputs.PR != true }}
25+
uses: anothrNick/[email protected]
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
WITH_V: false
29+
DEFAULT_BUMP: patch
30+
RELEASE_BRANCHES: ${{ inputs.RELEASE_BRANCH }}
31+
DRY_RUN: true
32+
33+
- name: Rename Tag Output
34+
id: tag
35+
if: ${{ inputs.PR != true }}
36+
run: echo "TAG=${{ steps.generate.outputs.new_tag }}" >> $GITHUB_OUTPUT
37+
38+
- name: Generate Tag
39+
if: ${{ inputs.PR == true }}
40+
id: tag
41+
run: |
42+
sha=${{ github.event.pull_request.head.sha }}
43+
tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-${sha:0:8}"
44+
echo "TAG=$(echo ${tag})" >> $GITHUB_OUTPUT

.github/actions/verify.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Verify"
2+
description: "Verify code & access"
3+
inputs:
4+
GOLANG_VERSION:
5+
description: Go version to use
6+
default: "~1.18"
7+
required: false
8+
type: string
9+
10+
RUN_GOLANG_CI_LINT:
11+
description: Run golangci-lint
12+
default: true
13+
required: false
14+
type: boolean
15+
16+
GOLANG_CI_LINT_VERSION:
17+
description: golang-ci-lint version to use
18+
default: "v1.53.3"
19+
required: false
20+
type: string
21+
22+
RUN_GOLANG_TESTS:
23+
description: Run golang tests
24+
default: true
25+
required: false
26+
type: boolean
27+
runs:
28+
using: "composite"
29+
steps:
30+
- name: Verify container registry secrets
31+
run: |
32+
if [ "${{ secrets.CONTAINER_REGISTRY_URL }}" == "" ] || [ "${{ secrets.CONTAINER_REGISTRY_USERNAME }}" == "" ] || [ "${{ secrets.CONTAINER_REGISTRY_PASSWORD }}" == "" ]; then
33+
echo "Required secrets 'CONTAINER_REGISTRY_URL' or 'CONTAINER_REGISTRY_USERNAME' or 'CONTAINER_REGISTRY_PASSWORD' are not set!"
34+
exit 1
35+
fi
36+
- name: Verify Slack secrets
37+
run: |
38+
if [ "${{ secrets.SLACK_WEBHOOK_URL }}" == "" ] || [ "${{ secrets.ADMIN_TOKEN }}" == "" ]; then
39+
echo "Required Secret 'SLACK_WEBHOOK_URL' or 'ADMIN_TOKEN' is not set!"
40+
exit 1
41+
fi
42+
- name: Set up Go
43+
id: go
44+
uses: actions/setup-go@v5
45+
with:
46+
go-version: ${{ inputs.GOLANG_VERSION }}
47+
- name: Run Lint
48+
if: ${{ inputs.RUN_GOLANG_CI_LINT }}
49+
uses: golangci/golangci-lint-action@v6
50+
with:
51+
version: ${{ inputs.GOLANG_CI_LINT_VERSION }}
52+
only-new-issues: false
53+
args: --timeout 10m
54+
- name: Run Tests
55+
if: ${{ inputs.RUN_GOLANG_TESTS }}
56+
run: make test

0 commit comments

Comments
 (0)