Skip to content

Commit d7df06f

Browse files
authored
refactor(make)[NO-TICKET]: replace make with task (#43)
* refactor(make)[NO-TICKET]: replace make with task Signed-off-by: Georgy Khromov <[email protected]> * refactor(make)[NO-TICKET]: replace make with task Signed-off-by: Georgy Khromov <[email protected]> * refactor(make)[NO-TICKET]: replace make with task Signed-off-by: Georgy Khromov <[email protected]> * refactor(make)[NO-TICKET]: replace make with task Signed-off-by: Georgy Khromov <[email protected]> * refactor(make)[NO-TICKET]: replace make with task Signed-off-by: Georgy Khromov <[email protected]> * refactor(make)[NO-TICKET]: replace make with task Signed-off-by: Georgy Khromov <[email protected]> * refactor(make)[NO-TICKET]: replace make with task Signed-off-by: Georgy Khromov <[email protected]> * refactor(make)[NO-TICKET]: replace make with task Signed-off-by: Georgy Khromov <[email protected]> * refactor(githubActions)[NO-TICKET]: add workflows for tag and backport Signed-off-by: Georgy Khromov <[email protected]> * refactor(make)[NO-TICKET]: update README.md Signed-off-by: Georgy Khromov <[email protected]> --------- Signed-off-by: Georgy Khromov <[email protected]>
1 parent f1eb92e commit d7df06f

File tree

11 files changed

+389
-250
lines changed

11 files changed

+389
-250
lines changed

.github/workflows/backport.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Backport
2+
3+
on:
4+
# NOTE(negz): This is a risky target, but we run this action only when and if
5+
# a PR is closed, then filter down to specifically merged PRs. We also don't
6+
# invoke any scripts, etc from within the repo. I believe the fact that we'll
7+
# be able to review PRs before this runs makes this fairly safe.
8+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
9+
pull_request_target:
10+
types: [closed]
11+
12+
jobs:
13+
# NOTE(negz): I tested many backport GitHub actions before landing on this
14+
# one. Many do not support merge commits, or do not support pull requests with
15+
# more than one commit. This one does. It also handily links backport PRs with
16+
# new PRs, and provides commentary and instructions when it can't backport.
17+
# The main gotchas with this action are that it _only_ supports merge commits,
18+
# and that PRs _must_ be labelled before they're merged to trigger a backport.
19+
open-pr:
20+
runs-on: ubuntu-22.04
21+
if: github.event.pull_request.merged
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Open Backport PR
29+
uses: zeebe-io/[email protected]
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
github_workspace: ${{ github.workspace }}
33+
version: v0.0.4

.github/workflows/ci.yaml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,43 @@ on:
66
- "release-*"
77
pull_request:
88
branches: [ main ]
9+
workflow_dispatch: {}
10+
11+
env:
12+
GO_VERSION: '1.24'
13+
914
jobs:
1015
compile:
1116
name: Compile
1217
runs-on: ubuntu-latest
1318
timeout-minutes: 10
1419
steps:
1520
- name: Set up Go 1.x
16-
uses: actions/setup-go@v4
21+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
1722
with:
18-
go-version: '1.24'
23+
go-version: ${{ env.GO_VERSION }}
1924
id: go
25+
26+
- name: Set up Task
27+
uses: arduino/setup-task@v1
28+
with:
29+
version: 3.x
30+
2031
- name: Check out code into the Go module directory
21-
uses: actions/checkout@v3
32+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33+
2234
- name: Restore Go build cache
23-
uses: actions/cache@v3
35+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
2436
with:
2537
path: ~/.cache/go-build
2638
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
39+
2740
- name: Get dependencies
2841
run: go mod download
42+
2943
- name: build
30-
run: make
44+
run: task
45+
3146
test:
3247
name: Unit Test
3348
runs-on: ubuntu-latest
@@ -36,13 +51,21 @@ jobs:
3651
GOPATH: /home/runner/go
3752
steps:
3853
- uses: actions/checkout@v3
54+
3955
- name: Setup Golang
4056
uses: actions/setup-go@v4
4157
with:
42-
go-version: '1.24'
58+
go-version: ${{ env.GO_VERSION }}
59+
60+
- name: Install Task
61+
uses: arduino/setup-task@v1
62+
with:
63+
version: 3.x
64+
4365
- name: Restore Go build cache
4466
uses: actions/cache@v3
4567
with:
4668
path: ~/.cache/go-build
4769
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
48-
- run: make test
70+
71+
- run: task test

.github/workflows/golangci-lint.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ on:
55
- master
66
- main
77
pull_request:
8+
workflow_dispatch:
89

10+
env:
11+
GO_VERSION: '1.24'
12+
GOLANGCI_LINT_VERSION: 'v2.1.6'
913

1014
permissions:
1115
contents: read
@@ -18,12 +22,14 @@ jobs:
1822
runs-on: ubuntu-latest
1923
steps:
2024
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3
25+
2126
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # pin@v4
2227
with:
23-
go-version: '1.24'
28+
go-version: ${{ env.GO_VERSION }}
2429
cache: false
30+
2531
- name: golangci-lint
2632
uses: golangci/golangci-lint-action@v8
2733
with:
28-
version: v2.1.6
34+
version: ${{ env.GOLANGCI_LINT_VERSION }}
2935

.github/workflows/release.yaml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ jobs:
1515
if: github.repository == 'argoproj-labs/argocd-rbac-operator'
1616
env:
1717
REGISTRY_URL: quay.io
18-
ORG: argoprojlabs
19-
REPO: argocd-rbac-operator
2018
name: Release
2119
steps:
2220
- name: Checkout
@@ -29,37 +27,23 @@ jobs:
2927
with:
3028
go-version: '1.24'
3129

32-
- name: Set env
33-
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
30+
- name: Set up task
31+
uses: arduino/setup-task@v1
32+
with:
33+
version: 3.x
3434

3535
- name: Restore go build cache
3636
uses: actions/cache@v4
3737
with:
3838
path: ~/.cache/go-build
3939
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
4040

41-
- name: Build operator and Tag Latest
42-
run: make docker-build
43-
env:
44-
IMG: ${{ env.REGISTRY_URL }}/${{ env.ORG }}/${{ env.REPO }}:latest
45-
46-
- name: Build operator and Tag Version
47-
run: make docker-build
48-
env:
49-
IMG: ${{ env.REGISTRY_URL }}/${{ env.ORG }}/${{ env.REPO }}:${{ env.VERSION }}
50-
5141
- name: Login to Registry
5242
uses: docker/login-action@v3
5343
with:
5444
registry: ${{ env.REGISTRY_URL }}
5545
username: ${{ secrets.QUAY_USERNAME }}
5646
password: ${{ secrets.QUAY_TOKEN }}
5747

58-
- name: Push latest operator
59-
run: make docker-push
60-
env:
61-
IMG: ${{ env.REGISTRY_URL }}/${{ env.ORG }}/${{ env.REPO }}:latest
62-
- name: Push latest operator
63-
run: make docker-push
64-
env:
65-
IMG: ${{ env.REGISTRY_URL }}/${{ env.ORG }}/${{ env.REPO }}:${{ env.VERSION }}
48+
- name: Buildand push operator to registry
49+
run: task docker-buildx

.github/workflows/tag.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Tag
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version (e.g. v0.1.0)'
8+
required: true
9+
message:
10+
description: 'Tag message'
11+
required: true
12+
13+
jobs:
14+
create-tag:
15+
runs-on: ubuntu-22.04
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
21+
- name: Create Tag
22+
uses: negz/create-tag@v1
23+
with:
24+
version: ${{ github.event.inputs.version }}
25+
message: ${{ github.event.inputs.message }}
26+
token: ${{ secrets.GITHUB_TOKEN }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.24 AS builder
2+
FROM --platform=${BUILDPLATFORM} golang:1.24 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

0 commit comments

Comments
 (0)