Skip to content

Commit 9b44870

Browse files
Merge pull request #4 from openobserve/github-actions
modified ci.yaml, ci manual.yaml, artifacts.yaml files
2 parents 9d14308 + df160a5 commit 9b44870

File tree

3 files changed

+57
-47
lines changed

3 files changed

+57
-47
lines changed

.github/workflows/artifacts.yaml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,20 @@ name: Artifacts
33
on:
44
workflow_call:
55
inputs:
6+
branch:
7+
description: "Branch to build image from"
8+
required: false
9+
type: string
610
publish:
711
description: Publish artifacts to the artifact store
812
default: false
913
required: false
1014
type: boolean
15+
release_name:
16+
description: "A overridden tag name for the release"
17+
required: false
18+
type: string
19+
1120
secrets:
1221
AWS_ROLE_ARN:
1322
required: true
@@ -55,6 +64,8 @@ jobs:
5564
steps:
5665
- name: Checkout Repository
5766
uses: actions/checkout@v4
67+
with:
68+
ref: ${{ github.event.inputs.branch || 'master' }} # Ensure input branch is properly referenced
5869

5970
- name: Set up QEMU
6071
uses: docker/setup-qemu-action@v3
@@ -82,29 +93,40 @@ jobs:
8293
id: platform-name
8394
run: echo "PLATFORM_TAG=${{ matrix.platform }}" | sed 's/\//-/g' >> $GITHUB_ENV
8495

85-
- name: Extract Short SHA for Unique Tagging
86-
id: short-sha
87-
run: echo "SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
96+
# - name: Extract Short SHA for Unique Tagging
97+
# id: short-sha
98+
# run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
99+
- name: Determine Image Tag
100+
id: image-tag
101+
run: |
102+
if [[ -n "${{ inputs.release_name }}" ]]; then
103+
echo "IMAGE_TAG=${{ inputs.release_name }}" >> $GITHUB_ENV
104+
else
105+
echo "IMAGE_TAG=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
106+
fi
107+
88108
89109
- name: Determine build output
90110
uses: haya14busa/action-cond@v1
91111
id: build-output
92112
with:
93-
cond: ${{ github.event_name == 'push' }}
113+
cond: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
94114
if_true: type=image,push=true
95115
if_false: type=oci,dest=image.tar
96-
116+
97117
- name: Build Image
98118
id: build
99119
uses: docker/build-push-action@v6
100120
with:
101121
context: .
102122
platforms: ${{ matrix.platform }}
103123
tags: |
104-
${{ steps.image-name.outputs.value }}:${{ matrix.variant }}-${{ env.PLATFORM_TAG }}-${{ env.SHORT_SHA }}
105-
${{ steps.image-name.outputs.value }}:${{ matrix.variant }}-${{ env.PLATFORM_TAG }}-latest
124+
${{ steps.image-name.outputs.value }}:${{ matrix.variant }}-${{ env.PLATFORM_TAG }}-${{ env.IMAGE_TAG }}
125+
# ${{ steps.image-name.outputs.value }}:${{ matrix.variant }}-${{ env.PLATFORM_TAG }}-${{ env.SHORT_SHA }}
126+
# ${{ steps.image-name.outputs.value }}:${{ matrix.variant }}-${{ env.PLATFORM_TAG }}-latest
106127
build-args: |
107128
BASE_IMAGE=${{ matrix.variant }}
129+
GIT_COMMIT_SHA=${{ env.SHORT_SHA }} # Explicitly pass SHA
108130
outputs: ${{ steps.build-output.outputs.value }}
109131
provenance: false # Prevents unnecessary provenance attestations
110132

@@ -166,9 +188,10 @@ jobs:
166188
with:
167189
sarif_file: trivy-results.sarif
168190

169-
- name: Upload Image as Artifact
191+
- name: Upload Image as Artifact (Only for PRs)
170192
uses: actions/upload-artifact@v4
171193
with:
172194
name: "OCI-Image-${{ matrix.variant }}-${{ env.PLATFORM_TAG }}"
173195
path: image.tar
174-
196+
if: github.event_name == 'pull_request'
197+

.github/workflows/ci manual.yaml

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
name: CI Manual
2-
32
on:
43
workflow_dispatch:
54
inputs:
6-
dex_repo:
7-
description: "dex_repo sha used for building the binary"
5+
branch:
6+
description: "Branch to build image from"
87
required: true
9-
default: "main"
10-
type: string
11-
push:
12-
branches: [ master ]
13-
pull_request:
14-
15-
8+
default: "master"
9+
release_name:
10+
description: "A overridden tag name for the release for e.g. v10.0.0-beta.1-hot-fix"
11+
required: false
12+
type: string
13+
1614
permissions:
1715
contents: read
1816

19-
20-
21-
2217
jobs:
2318
test:
2419
name: Test
@@ -76,18 +71,15 @@ jobs:
7671
options: --health-cmd "curl --fail http://localhost:5000/v3" --health-interval 10s --health-timeout 5s --health-retries 5
7772

7873
steps:
79-
- name: Checkout dex branch
80-
uses: actions/checkout@v4
74+
- name: Checkout repository
75+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8176
with:
82-
repository: openobserve/dex
83-
ref: ${{ github.event.inputs.dex_repo }}
84-
fetch-depth: 0
85-
path: dex
77+
ref: ${{ github.event.inputs.branch }} # Checkout the selected branch
8678

8779
- name: Set up Go
88-
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
80+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
8981
with:
90-
go-version: "1.21"
82+
go-version: "1.24"
9183

9284
- name: Download tool dependencies
9385
run: make deps
@@ -99,7 +91,7 @@ jobs:
9991
run: docker compose -f docker-compose.test.yaml up -d
10092

10193
- name: Create kind cluster
102-
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
94+
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
10395
with:
10496
version: "v0.17.0"
10597
node_image: "kindest/node:v1.25.3@sha256:cd248d1438192f7814fbca8fede13cfe5b9918746dfa12583976158a834fd5c5"
@@ -150,12 +142,14 @@ jobs:
150142

151143
steps:
152144
- name: Checkout repository
153-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
145+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
146+
with:
147+
ref: ${{ github.event.inputs.branch }} # Ensure correct branch is checked out
154148

155149
- name: Set up Go
156-
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
150+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
157151
with:
158-
go-version: "1.21"
152+
go-version: "1.24"
159153

160154
- name: Download golangci-lint
161155
run: make bin/golangci-lint
@@ -167,7 +161,10 @@ jobs:
167161
name: Artifacts
168162
uses: ./.github/workflows/artifacts.yaml
169163
with:
170-
publish: ${{ github.event_name == 'push' }}
164+
branch: ${{ github.event.inputs.branch }} # Pass branch input to artifacts.yaml
165+
publish: true
166+
release_name: ${{ github.event.inputs.release_name }} # Pass release_name to artifacts.yaml
167+
171168
secrets:
172169
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
173170
AWS_REGION: ${{ secrets.AWS_REGION }}
@@ -177,15 +174,4 @@ jobs:
177174
packages: write
178175
id-token: write
179176
security-events: write
180-
181-
dependency-review:
182-
name: Dependency review
183-
runs-on: ubuntu-latest
184-
if: github.event_name == 'pull_request'
185-
186-
steps:
187-
- name: Checkout repository
188-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
189-
190-
- name: Dependency Review
191-
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4
177+

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,4 @@ jobs:
173173

174174
- name: Dependency Review
175175
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0
176+

0 commit comments

Comments
 (0)