Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from ca-gip:master #2

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
544c3b4
:art: :arrow_up: Refactor structure and upgrade to v0.24.13
cheqrouni Jun 19, 2023
3218a7a
Merge pull request #26 from cheqrouni/feature/refact-upgrade-to-v0.24.13
Whisper40 Jun 22, 2023
541b82f
Update Readme (from v0.24.0 to v1.24.0 due to pkg.go logic)
Jun 22, 2023
ce72eac
:arrow_up: Update github actions build and release
cheqrouni Jun 22, 2023
322d206
Merge pull request #28 from cheqrouni/feature/githubactions-upgrade
Whisper40 Jun 23, 2023
e2628ec
✨ Allow user to define PageSize in order to do not be blocked by ldap…
Aug 25, 2023
084fc1a
🗑️ Version file not useful anymore
Aug 28, 2023
654248f
🔧 Set maxPageSize to 1000 (RFC 2696)
Aug 28, 2023
e8ffcdb
👷 Build using go 1.21
Oct 19, 2023
31f22dc
⬆️ Upgrade to support Kubernetes 1.26
Oct 19, 2023
5514035
Merge pull request #31 from ca-gip/1.26
Whisper40 Jan 8, 2024
3059802
✨ Mise en place des PodSecurityAdmission sur les namespaces clients
Jan 10, 2024
8bc6831
Merge pull request #34 from ca-gip/psp-to-psa
evrardjp Jan 10, 2024
cfaaa6a
⬆️ Upgrade packages for Kube 1.28
Aug 2, 2024
d3938d3
✏️ Use KubeCodeGen instead of generate-groups script, because it is n…
Aug 2, 2024
2e43196
👷 Update CI packages
Aug 2, 2024
a55d2ad
Merge pull request #37 from ca-gip/upgrade-128
zkonak Aug 2, 2024
35fee40
✏️ Fix Status Field into Kubi CRD
Aug 2, 2024
efa5cbd
Merge pull request #38 from ca-gip/fix-crd
Whisper40 Aug 2, 2024
37af7d5
:hammer: fix blackWhiteList feature
Oct 28, 2024
4e0e4fb
:hammer: make the function GenerateProjects easily testable
Nov 5, 2024
0073ab6
:hammer: adapt unit test for more flexibility
Nov 14, 2024
a26eb95
Merge pull request #40 from ca-gip/fixBlackWhiteList_1.28
evrardjp Nov 15, 2024
a8a717d
FIX KUBE INSTALLATION (#46)
amiraaz Nov 28, 2024
dfc8daa
Cleanup DS_Store
evrardjp Dec 2, 2024
d51e6c5
Fix staticcheck warnings
evrardjp-cagip Dec 16, 2024
fe946d4
Add basic error handling
evrardjp-cagip Dec 16, 2024
b717c90
Use goreleaser to cleanup the release building
evrardjp Dec 2, 2024
3b74cbd
Merge pull request #48 from evrardjp-cagip/staticcheck_fixing
zkonak Dec 17, 2024
4f51e6f
Merge pull request #50 from evrardjp-cagip/dev-env-setup
zkonak Dec 17, 2024
62883bc
Set goreleaser version
evrardjp-cagip Dec 17, 2024
04785e1
Bump go releaser
evrardjp-cagip Dec 17, 2024
e4050fd
Merge pull request #51 from evrardjp-cagip/bump_goreleaser
zkonak Dec 17, 2024
9d781be
Use goreleaser to push release
evrardjp-cagip Dec 17, 2024
055c086
Merge pull request #52 from evrardjp-cagip/change_releasing
zkonak Dec 17, 2024
7b2ad03
Fix goreleaser usage
evrardjp-cagip Dec 18, 2024
12a50be
Fix Dockerfile
evrardjp-cagip Dec 18, 2024
0a51f59
Merge pull request #54 from evrardjp-cagip/fix_goreleaser
evrardjp-cagip Dec 18, 2024
1462166
Upgrade go packages for kubernetes 1.30.8
zelihacagip Nov 18, 2024
75765fb
Merge pull request #45 from ca-gip/dev_1.30
evrardjp-cagip Dec 19, 2024
656bd82
Remove go-ozzo/ozza-validation package
zelihacagip Dec 19, 2024
bea3378
Merge pull request #56 from ca-gip/feat/remove-go-ozzo
evrardjp-cagip Dec 23, 2024
f409d9e
Revert "Remove go-ozzo/ozzo-validation package"
evrardjp-cagip Dec 23, 2024
2468b6a
Merge pull request #57 from ca-gip/revert-56-feat/remove-go-ozzo
evrardjp-cagip Dec 23, 2024
8aef4c9
Fix incorrect name of releasable image
evrardjp-cagip Jan 7, 2025
6cd9179
Merge pull request #58 from evrardjp-cagip/debug_release_failure
zkonak Jan 7, 2025
613823e
Remove dashes in the dockerhub repositories
evrardjp-cagip Jan 7, 2025
0c43a9b
Merge pull request #59 from evrardjp-cagip/fix-another-dash
zkonak Jan 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
74 changes: 43 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,57 @@
name: build
name: pr

on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'

env:
REGISTRY: ghcr.io

jobs:
release:
name: Create Build
pr-tests:
name: Build and test images
runs-on: ubuntu-latest
strategy:
matrix:
component: [webhook, api, operator]
arch: [amd64]
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Docker meta
id: meta
uses: docker/metadata-action@v3
- name: Checkout
uses: actions/checkout@v4

- name: Find current tag version
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
id: tags

- uses: actions/setup-go@v5
with:
images: cagip/kubi-${{ matrix.component }}
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
go-version: '1.23'

- name: run tests
run: make test

- uses: goreleaser/goreleaser-action@v6
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
distribution: goreleaser
version: v2.5.0
args: release --snapshot --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG: ${{ github.REPOSITORY_OWNER }}

- name: Login to container registry
# Pull requests are targetting ca-gip/kubi and should not push an image
# Only push images for the fork's repository
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
context: .
file: Dockerfile.${{ matrix.component }}
push: ${{ GitHub.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push development image into ghcr (packages)
# Pull requests are targetting ca-gip/kubi and should not push an image
# Only push images for the fork's repository
if: github.event_name != 'pull_request'
run: |
docker push ${{ env.REGISTRY }}/${{ github.REPOSITORY_OWNER }}/kubi-${{ matrix.component }}:${{ steps.tags.outputs.sha_short }}-${{ matrix.arch }}
68 changes: 52 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,67 @@
name: release
name: Tag repo

on:
push:
tags:
- "*"

env:
REGISTRY: docker.io

permissions:
contents: read

jobs:
release:
name: Create Release
permissions:
id-token: write
contents: write
packages: write
runs-on: ubuntu-latest
strategy:
matrix:
component: [webhook, api, operator]
arch: [amd64]
steps:
-
name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
- run: git fetch --force --tags

- name: Find current sha version
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
id: sha

- name: Find current tag version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
id: tag

- uses: actions/setup-go@v5
with:
go-version: 1.17
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
go-version: '1.23'

- name: run tests to ensure it is still releasable
run: make test

- uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --rm-dist
workdir: ./cmd/operator
distribution: goreleaser
version: v2.5.0
args: release --snapshot --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG: ${{ github.REPOSITORY_OWNER }}

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

- name: Push development image into dockerhub
run: |
docker images #display currently built images to ensure next calls will happen correctly
docker tag ghcr.io/ca-gip/kubi-${{ matrix.component }}:${{ steps.sha.outputs.sha_short }}-${{ matrix.arch }} cagip/kubi-${{ matrix.component }}:${{ steps.sha.outputs.sha_short }}-${{ matrix.arch }}
docker push cagip/kubi-${{ matrix.component }}:${{ steps.sha.outputs.sha_short }}-${{ matrix.arch }}
docker tag ghcr.io/ca-gip/kubi-${{ matrix.component }}:${{ steps.sha.outputs.sha_short }}-${{ matrix.arch }} cagip/kubi-${{ matrix.component }}:${{ steps.tag.outputs.version }}
docker push cagip/kubi-${{ matrix.component }}:${{ steps.tag.outputs.version }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ vendor
coverage.*
kubi
bin
build/*
hack/bin
dist/
115 changes: 115 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
version: 2
project_name: kubi
before:
hooks:
- make clean
- make deps
builds:
- main: ./cmd/api/main.go
id: api
binary: kubi-api
env:
- CGO_ENABLED=0
goarch:
- amd64
- arm64
goos:
- linux
ldflags:
- -s -w -X main.version={{ if .IsSnapshot }}{{ .ShortCommit }}{{ else }}{{ .Version }}{{ end }}
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath

- main: ./cmd/authorization-webhook/main.go
id: webhook
binary: kubi-webhook
env:
- CGO_ENABLED=0
goarch:
- amd64
- arm64
goos:
- linux
ldflags:
- -s -w -X main.version={{ if .IsSnapshot }}{{ .ShortCommit }}{{ else }}{{ .Version }}{{ end }}
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath

- main: ./cmd/operator/main.go
id: operator
binary: kubi-operator
env:
- CGO_ENABLED=0
goarch:
- amd64
- arm64
goos:
- linux
ldflags:
- -s -w -X main.version={{ if .IsSnapshot }}{{ .ShortCommit }}{{ else }}{{ .Version }}{{ end }}
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath

dockers:
- id: docker-operator
ids:
- operator
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--build-arg=BINARYNAME=operator"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}-operator"
- "--label=org.opencontainers.image.source=https://github.com/{{.Env.ORG}}/{{.ProjectName}}"
- "--label=org.opencontainers.image.url=https://github.com/{{.Env.ORG}}/{{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
image_templates:
- "ghcr.io/{{.Env.ORG}}/{{.ProjectName}}-operator:{{.ShortCommit}}-amd64"

- id: docker-api
ids:
- api
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--build-arg=BINARYNAME=api"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}-api"
- "--label=org.opencontainers.image.source=https://github.com/{{.Env.ORG}}/{{.ProjectName}}"
- "--label=org.opencontainers.image.url=https://github.com/{{.Env.ORG}}/{{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
image_templates:
- "ghcr.io/{{.Env.ORG}}/{{.ProjectName}}-api:{{.ShortCommit}}-amd64"

- id: docker-webhook
ids:
- webhook
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--build-arg=BINARYNAME=webhook"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}-webhook"
- "--label=org.opencontainers.image.source=https://github.com/{{.Env.ORG}}/{{.ProjectName}}"
- "--label=org.opencontainers.image.url=https://github.com/{{.Env.ORG}}/{{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
image_templates:
- "ghcr.io/{{.Env.ORG}}/{{.ProjectName}}-webhook:{{.ShortCommit}}-amd64"

snapshot:
version_template: "{{ .ShortCommit }}"

release:
disable: true

changelog:
disable: true
Loading