Skip to content

Commit

Permalink
Update Kubebuilder/components versions (#97)
Browse files Browse the repository at this point in the history
* Update Kubebuilder/components versions

Signed-off-by: rustyclock <[email protected]>

* Fix linting errors

Signed-off-by: rustyclock <[email protected]>

* Fix Github Actions workflows

Signed-off-by: rustyclock <[email protected]>

* Fix Github Actions workflows

Signed-off-by: rustyclock <[email protected]>

* Fix Github Actions workflows

Signed-off-by: rustyclock <[email protected]>

* Fix Github Actions workflows

Signed-off-by: rustyclock <[email protected]>

* Apply review feedback

Signed-off-by: rustyclock <[email protected]>

* Fix linting errors

Signed-off-by: rustyclock <[email protected]>

---------

Signed-off-by: rustyclock <[email protected]>
  • Loading branch information
rustycl0ck authored Jun 9, 2023
1 parent 6d9032d commit 53eb438
Show file tree
Hide file tree
Showing 62 changed files with 780 additions and 770 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

# Only include Go files
!internal
!controllers
!api
!main.go
!cmd
!go.mod
!go.sum
7 changes: 5 additions & 2 deletions .github/workflows/check-tag-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ on:

jobs:
bump-tag-check:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions-ecosystem/action-release-label@v1
id: bump-label
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@ on:
- master
- main
pull_request:
permissions:
contents: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
## golang v1.18 breaks golangci-lint <= v1.45
## ref: https://github.com/golangci/golangci-lint/issues/2374#issuecomment-1069029422
go-version: '1.17'
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.44.0
version: latest
19 changes: 11 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ on:

jobs:
create-release:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0 ## Required for goreleaser - https://goreleaser.com/ci/actions/#usage

Expand All @@ -37,25 +40,25 @@ jobs:
CURRENT_TAG: ${{ inputs.version }}

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.17
go-version-file: go.mod

- name: Create Github Release
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v4
with:
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
push: true
tags: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: Size

on:
pull_request_target:
types: [opened, synchronize]
pull_request:

jobs:
update_labels:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions-ecosystem/action-size@v2
id: size

- uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ steps.size.outputs.stale_labels }}

- uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ steps.size.outputs.new_label }}
7 changes: 5 additions & 2 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ on:

jobs:
bump-tag:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
outputs:
new_version: ${{ steps.bump-semver.outputs.new_version }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Get Merged Pull Request
uses: actions-ecosystem/action-get-merged-pull-request@v1
Expand Down
16 changes: 4 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@ on:

jobs:
test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
with:
go-version: 1.17
id: go

- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/cache@v2
- uses: actions/setup-go@v4
with:
path: ~/go/pkg/mod/cache
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version-file: go.mod

- run: make test
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
vendor/

# Binaries for programs and plugins
*.exe
Expand All @@ -8,6 +7,7 @@ vendor/
*.dylib
bin
testbin/*
Dockerfile.cross

# Test binary, build with `go test -c`
*.test
Expand All @@ -24,5 +24,3 @@ testbin/*
*.swp
*.swo
*~

secrets
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ linters:
enable:
- bodyclose
- deadcode
- depguard
# - depguard # disable this temporarily until we confirm and create an allow-list of the imported modules
- dogsled
- exportloopref
- errcheck
Expand Down
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Build the manager binary
FROM golang:1.17 AS builder
FROM golang:1.19 as builder
ARG TARGETOS
ARG TARGETARCH

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -10,13 +12,16 @@ COPY go.sum go.sum
RUN go mod download

# Copy the go source
COPY internal/ internal/
COPY main.go main.go
COPY cmd/ cmd/
COPY api/ api/
COPY controllers/ controllers/
COPY internal/ internal/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
# the GOARCH has not a default value to allow the binary be built according to the host where the command
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
Loading

0 comments on commit 53eb438

Please sign in to comment.