Skip to content

Commit ad25a7d

Browse files
committed
Pipeline
Signed-off-by: Jirka Kremser <[email protected]>
1 parent da1eb7c commit ad25a7d

File tree

5 files changed

+104
-5
lines changed

5 files changed

+104
-5
lines changed

.github/workflows/go-pr-check.yaml

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: 'PR checks'
2-
# todo: pr to github meta (we don't need to setup private repos here)
32
on:
43
pull_request_target:
54
branches: [main]
@@ -65,3 +64,23 @@ jobs:
6564

6665
- name: Test
6766
run: make test
67+
68+
build-and-publish-images:
69+
needs: [ go-build-test ]
70+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
71+
secrets: inherit
72+
uses: ./.github/workflows/release-image.yml
73+
with:
74+
tag: ${{ github.ref_name }}
75+
76+
run-e2e-tests:
77+
needs: [ build-and-publish-images ]
78+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
79+
steps:
80+
- uses: actions/checkout@v4
81+
with:
82+
fetch-depth: 0
83+
- name: Run the end to end tests
84+
env:
85+
OTEL_SCALER_VERSION: ${{ github.ref_name }}
86+
run: make e2e-tests

.github/workflows/release-image.yaml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: 'Release the container image'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
type: string
8+
required: true
9+
description: "git tag to checkout and create the release"
10+
workflow_call:
11+
inputs:
12+
tag:
13+
type: string
14+
required: true
15+
description: "git tag to checkout and create the release"
16+
17+
jobs:
18+
build-and-publish-images:
19+
timeout-minutes: 100
20+
runs-on: ubuntu-latest
21+
22+
permissions:
23+
contents: write
24+
packages: write
25+
id-token: write # needed for signing the images with GitHub OIDC Token
26+
27+
name: build-images
28+
steps:
29+
- name: Maximize build space
30+
uses: easimon/maximize-build-space@v10
31+
with:
32+
overprovision-lvm: 'true'
33+
remove-dotnet: 'true'
34+
remove-android: 'true'
35+
remove-haskell: 'true'
36+
remove-codeql: 'true'
37+
remove-docker-images: 'true'
38+
39+
- uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 1
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- uses: actions/setup-go@v5
45+
with:
46+
go-version: "1.23"
47+
48+
- name: Install Cosign
49+
uses: sigstore/[email protected]
50+
51+
- name: Login to GitHub Container Registry
52+
uses: docker/login-action@v3
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Set up QEMU # required for multi-arch builds by GoReleaser
59+
uses: docker/setup-qemu-action@v3
60+
61+
- name: Install arm C compiler toolchain # for boring crypto
62+
run: sudo apt-get update && sudo apt-get install -y gccgo-aarch64-linux-gnu
63+
64+
- name: Set up Docker Buildx
65+
uses: docker/setup-buildx-action@v3
66+
67+
- name: Release with goreleaser
68+
timeout-minutes: 90
69+
uses: goreleaser/goreleaser-action@v4
70+
with:
71+
distribution: goreleaser
72+
version: '~> v1'
73+
args: release --clean --timeout 90m
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
IMAGE_TAG: ${{ inputs.tag }}

.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
build-and-publish-images:
1111
secrets: inherit
12-
uses: kedify/github-meta/.github/workflows/kedify-release.yml@main
12+
uses: ./.github/workflows/release-image.yml
1313
with:
1414
tag: ${{ github.ref_name }}
1515

e2e-tests/podinfo_test.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@ var _ = Describe("Helm chart", func() {
7676
Expect(err).NotTo(HaveOccurred(), "helm upgrade -i failed: %s", err)
7777
})
7878
It("kedify-otel should be possible to install", func() {
79-
// latest released chart
80-
//err := helmChartInstall("kedify-otel", "--version=v0.0.1-2 -f ./testdata/scaler-values.yaml")
81-
err := execCmdE(fmt.Sprintf("helm upgrade -i kedify-otel ../helmchart/otel-add-on -f ./testdata/scaler-values.yaml"))
79+
cmd := "helm upgrade -i kedify-otel ../helmchart/otel-add-on -f ./testdata/scaler-values.yaml"
80+
if len(otelScalerVersion) > 0 {
81+
cmd += fmt.Sprintf(" --set image.tag=%s", otelScalerVersion)
82+
}
83+
err := execCmdE(cmd)
8284
Expect(err).NotTo(HaveOccurred(), "helm upgrade -i failed: %s", err)
8385
})
8486
It("kedify/keda should be possible to install", func() {

e2e-tests/test_utils.go

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package e2e_tests
33
import (
44
"context"
55
"fmt"
6+
"os"
67
"os/exec"
78
"runtime"
89
"strings"
@@ -46,6 +47,7 @@ var (
4647
"kedify": "keda",
4748
"kedify-otel": "otel-add-on",
4849
}
50+
otelScalerVersion, _ = os.LookupEnv("OTEL_SCALER_VERSION")
4951
)
5052

5153
type TestContext struct {

0 commit comments

Comments
 (0)