Skip to content

Commit

Permalink
Update operator SDK and CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
sarunask committed Jan 24, 2024
1 parent 4c13c05 commit 2047c3f
Show file tree
Hide file tree
Showing 4,415 changed files with 911,757 additions and 301,986 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
89 changes: 0 additions & 89 deletions .circleci/config.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore all files which are not go type
!**/*.go
!**/*.mod
!**/*.sum
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
102 changes: 102 additions & 0 deletions .github/workflows/pr-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: pr_check elasticobjects-operator

on:
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
- 'helm/**'
- '.github/**'
types:
- opened
- reopened
- edited
- synchronize

concurrency:
group: ci-tests-${{ inputs.git_repo }}-${{ github.ref }}-1
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive

- name: Install latest major GO version
uses: actions/setup-go@v4
with:
go-version: '1.21' # The Go version to download

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: 'v1.55'
working-directory: '.'
args: --allow-parallel-runners -v --timeout 5m
skip-pkg-cache: true
skip-build-cache: true

build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive

- name: Install latest major GO version
uses: actions/setup-go@v4
with:
go-version: '1.21' # The Go version to download

- name: Build executables locally
run: |
make build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASS }}

- name: Dockerise
uses: docker/build-push-action@v5
with:
context: ./
builder: ${{ steps.buildx.outputs.name }}
platforms: 'linux/amd64,linux/arm64'
tags: kafkaobjects-operator:dev
file: Dockerfile
push: false

test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive

- name: Install latest major GO version
uses: actions/setup-go@v4
with:
go-version: '1.21' # The Go version to download

- name: Test locally
run:
make test
67 changes: 67 additions & 0 deletions .github/workflows/ship.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: elasticobjects-operator ship action

on:
push:
tags:
- 'operator/v*'

concurrency:
group: ci-ship-${{ inputs.git_repo }}-${{ github.ref }}-1
cancel-in-progress: true

jobs:
ship:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive

- uses: olegtarasov/[email protected]
id: tagName
with:
tagRegex: 'operator/(.*)'
tagRegexGroup: 1

- name: Create valid tag(s)
id: tags
run: |
name="90poe/kafkaobjects-operator"
output="$name:${{ steps.tagName.outputs.tag }},$name:latest"
echo "::set-output name=all_tags::${output}"
- name: Install latest major GO version
uses: actions/setup-go@v4
with:
go-version: '1.21' # The Go version to download

- name: Make build for ${{ steps.tags.outputs.all_tags }}
run:
echo ${{ steps.tagName.outputs.tag }} > version.txt;
make build

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASS }}

- name: Dockerise
uses: docker/build-push-action@v5
with:
context: ./
builder: ${{ steps.buildx.outputs.name }}
platforms: "linux/amd64,linux/arm64"
tags: ${{ steps.tags.outputs.all_tags }}
file: Dockerfile
push: true
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Kubernetes Generated files - skip generated files, except for vendored files
!vendor/**/zz_generated.*
# editor and IDE paraphernalia
.idea
__debug*
# Temporary Build Files
build/_output
build/_test
cmd/__debug*
# Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
### Emacs ###
# -*- mode: gitignore; -*-
Expand All @@ -13,7 +17,6 @@ cmd/__debug*
auto-save-list
tramp
.\#*
bin
# Org-mode
.org-id-locations
*_archive
Expand Down Expand Up @@ -74,7 +77,9 @@ Session.vim
# auto-generated tag files
tags
### VisualStudioCode ###
.vscode/*
.vscode
.history
# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
artifacts
/bin
_build
69 changes: 69 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# options for analysis running
run:
# default concurrency is a available CPU number
concurrency: 4

# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 10m

# all available settings of specific linters
linters-settings:
errcheck:
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
check-type-assertions: true
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
check-blank: true
govet:
# report about shadowed variables
check-shadowing: false
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 30
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 2000
unused:
# treat code as a program (not a library) and report unused exported identifiers
check-exported: false
unparam:
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
check-exported: true
nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns
max-func-lines: 60
prealloc:
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
simple: true
range-loops: true # Report preallocation suggestions on range loops
for-loops: false # Report preallocation suggestions on for loops

linters:
disable-all: true
enable:
- govet
- errcheck
- gocyclo
- ineffassign
- typecheck
- unconvert
- goconst
- gocyclo
- staticcheck
- unused
- gosimple
- gofmt
- gosec
- lll
- megacheck
- gocritic
fast: false

issues:
# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
# Default value for this option is true.
exclude-use-default: true
exclude:
- "File is not `goimports`-ed"
Loading

0 comments on commit 2047c3f

Please sign in to comment.