-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
231 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Release - Delete Draft | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
type: string | ||
description: The tag of the release | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
jobs: | ||
release-delete: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check tag | ||
if: "${{ github.event.inputs.tag == '' }}" | ||
run: echo "::error::Missing tag from input" && exit 1 | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check if release is draft | ||
run: | | ||
CURRENT_TAG=${{ github.event.inputs.tag }} | ||
isDraft=$(gh release view ${CURRENT_TAG} --json isDraft --jq ".isDraft") | ||
if [ "$isDraft" = true ]; then | ||
echo "Release ${CURRENT_TAG} is draft" | ||
else | ||
echo "::error::Cannot delete non-draft release" && exit 1 | ||
fi | ||
- name: Delete packages from Github Container Registry | ||
run: | | ||
CURRENT_TAG=${{ github.event.inputs.tag }} | ||
echo "Deleting packages with tag ${CURRENT_TAG}" | ||
JQ_QUERY=".[] | select(.metadata.container.tags[] == \"${CURRENT_TAG}\")" | ||
for package in k3k k3k-kubelet | ||
do | ||
echo "Deleting ${package} image" | ||
PACKAGE_TO_DELETE=$(gh api /user/packages/container/${package}/versions --jq "${JQ_QUERY}") | ||
echo $PACKAGE_TO_DELETE | jq | ||
PACKAGE_ID=$(echo $PACKAGE_TO_DELETE | jq .id) | ||
echo "Deleting ${PACKAGE_ID}" | ||
gh api --method DELETE /user/packages/container/${package}/versions/${PACKAGE_ID} | ||
done | ||
- name: Delete Github release | ||
run: | | ||
CURRENT_TAG=${{ github.event.inputs.tag }} | ||
echo "Deleting release ${CURRENT_TAG}" | ||
gh release delete ${CURRENT_TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Release - Test Build | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
commit: | ||
type: string | ||
description: Checkout the specified commit | ||
registry: | ||
type: choice | ||
description: Select the container registry | ||
options: | ||
- ghcr.io | ||
- dockerhub | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
|
||
- name: Checkout code at the specific commit | ||
if: "${{ github.event.inputs.commit != '' }}" | ||
run: git checkout ${{ github.event.inputs.commit }} | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
|
||
- name: "Read secrets" | ||
uses: rancher-eio/read-vault-secrets@main | ||
if: "${{ github.event.inputs.registry == 'dockerhub' }}" | ||
with: | ||
secrets: | | ||
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials username | DOCKER_USERNAME ; | ||
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials password | DOCKER_PASSWORD ; | ||
- name: Login to Docker Container Registry | ||
uses: docker/login-action@v3 | ||
if: "${{ github.event.inputs.registry == 'dockerhub' }}" | ||
with: | ||
username: ${{ env.DOCKER_USERNAME }} | ||
password: ${{ env.DOCKER_PASSWORD }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
if: "${{ github.event.inputs.registry != 'dockerhub' }}" | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- name: Create fake tag | ||
id: fake-tag | ||
run: | | ||
CURRENT_TAG=$(git describe --tag --always) | ||
git tag ${CURRENT_TAG} | ||
echo "CURRENT_TAG=${CURRENT_TAG}" >> "$GITHUB_OUTPUT" | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
distribution: goreleaser | ||
version: v2 | ||
args: --clean --config .goreleaser-draft.yaml | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
GORELEASER_CURRENT_TAG: ${{ steps.fake-tag.outputs.CURRENT_TAG }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
version: 2 | ||
|
||
release: | ||
draft: true | ||
replace_existing_draft: true | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
- go generate ./... | ||
|
||
builds: | ||
- id: k3k | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
goarch: | ||
- "amd64" | ||
- "arm64" | ||
- "s390x" | ||
|
||
- id: k3k-kubelet | ||
main: ./k3k-kubelet | ||
binary: k3k-kubelet | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
goarch: | ||
- "amd64" | ||
- "arm64" | ||
- "s390x" | ||
|
||
- id: k3kcli | ||
main: ./cli | ||
binary: k3kcli | ||
env: | ||
- CGO_ENABLED=0 | ||
goarch: | ||
- "amd64" | ||
- "arm64" | ||
|
||
archives: | ||
- format: binary | ||
name_template: >- | ||
{{ .Binary }}-{{- .Os }}-{{ .Arch }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
|
||
dockers: | ||
- id: k3k | ||
use: docker | ||
ids: | ||
- k3k | ||
- k3kcli | ||
dockerfile: "package/Dockerfile" | ||
skip_push: false | ||
image_templates: | ||
- "ghcr.io/enrichman/k3k:{{ .Tag }}" | ||
build_flag_templates: | ||
- "--build-arg=BIN_K3K=k3k" | ||
- "--build-arg=BIN_K3KCLI=k3kcli" | ||
|
||
- id: k3k-kubelet | ||
use: docker | ||
ids: | ||
- k3k-kubelet | ||
dockerfile: "package/Dockerfile.kubelet" | ||
skip_push: false | ||
image_templates: | ||
- "ghcr.io/enrichman/k3k-kubelet:{{ .Tag }}" | ||
build_flag_templates: | ||
- "--build-arg=BIN_K3K_KUBELET=k3k-kubelet" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
FROM alpine | ||
COPY bin/k3k /usr/bin/ | ||
COPY bin/k3kcli /usr/bin/ | ||
|
||
ARG BIN_K3K=bin/k3k | ||
ARG BIN_K3KCLI=bin/k3kcli | ||
|
||
COPY ${BIN_K3K} /usr/bin/ | ||
COPY ${BIN_K3KCLI} /usr/bin/ | ||
|
||
CMD ["k3k"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# TODO: swicth this to BCI-micro or scratch. Left as base right now so that debug can be done a bit easier | ||
FROM registry.suse.com/bci/bci-base:15.6 | ||
|
||
COPY bin/k3k-kubelet /usr/bin/ | ||
ARG BIN_K3K_KUBELET=bin/k3k-kubelet | ||
|
||
COPY ${BIN_K3K_KUBELET} /usr/bin/ | ||
|
||
ENTRYPOINT ["/usr/bin/k3k-kubelet"] |