diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index c16009fb..00000000 --- a/.drone.yml +++ /dev/null @@ -1,160 +0,0 @@ ---- -kind: pipeline -name: amd64 - -platform: - os: linux - arch: amd64 - -steps: -- name: build - image: rancher/dapper:v0.6.0 - environment: - CROSS: 'true' - commands: - - dapper ci - - echo "${DRONE_TAG}-amd64" | sed -e 's/+/-/g' >.tags - volumes: - - name: docker - path: /var/run/docker.sock - when: - ref: - exclude: - - refs/tags/chart-* - -- name: package-chart - image: rancher/dapper:v0.6.0 - environment: - GITHUB_TOKEN: - from_secret: github_token - commands: - - dapper package-chart - volumes: - - name: docker - path: /var/run/docker.sock - when: - ref: - - refs/tags/chart-* - instance: - - drone-publish.rancher.io - event: - - tag - -- name: release-chart - image: plugins/github-release - settings: - api_key: - from_secret: github_token - checksum: - - sha256 - checksum_file: CHECKSUMsum.txt - checksum_flatten: true - files: - - "deploy/*" - when: - instance: - - drone-publish.rancher.io - ref: - include: - - refs/tags/chart-* - event: - - tag - -- name: index-chart - image: rancher/dapper:v0.6.0 - environment: - GITHUB_TOKEN: - from_secret: github_token - commands: - - dapper index-chart - volumes: - - name: docker - path: /var/run/docker.sock - when: - ref: - - refs/tags/chart-* - instance: - - drone-publish.rancher.io - event: - - tag - -- name: github_binary_release - image: plugins/github-release - settings: - api_key: - from_secret: github_token - prerelease: true - checksum: - - sha256 - checksum_file: CHECKSUMsum-amd64.txt - checksum_flatten: true - files: - - "bin/*" - when: - instance: - - drone-publish.rancher.io - ref: - include: - - refs/head/master - - refs/tags/* - exclude: - - refs/tags/chart-* - event: - - tag - -- name: docker-publish - image: plugins/docker - settings: - dockerfile: package/Dockerfile - password: - from_secret: docker_password - repo: "rancher/k3k" - username: - from_secret: docker_username - when: - instance: - - drone-publish.rancher.io - ref: - include: - - refs/head/master - - refs/tags/* - exclude: - - refs/tags/chart-* - event: - - tag - -volumes: -- name: docker - host: - path: /var/run/docker.sock ---- -kind: pipeline -type: docker -name: manifest - -platform: - os: linux - arch: amd64 - -steps: - - name: push-runtime-manifest - image: plugins/manifest - settings: - username: - from_secret: docker_username - password: - from_secret: docker_password - spec: manifest-runtime.tmpl - when: - event: - - tag - instance: - - drone-publish.rancher.io - ref: - include: - - refs/head/master - - refs/tags/* - exclude: - - refs/tags/chart-* -depends_on: - - amd64 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..e6d40cc9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,22 @@ +on: + push: + branches: + - master + pull_request: + +name: Build +permissions: + contents: read +jobs: + build-cross-arch: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Cross Arch Build + run: | + make ci + env: + CROSS: "true" + \ No newline at end of file diff --git a/.github/workflows/chart.yml b/.github/workflows/chart.yml new file mode 100644 index 00000000..b044572f --- /dev/null +++ b/.github/workflows/chart.yml @@ -0,0 +1,30 @@ +on: + push: + tags: + - "chart-*" + +name: Chart +permissions: + contents: write + id-token: write +jobs: + chart-release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Package Chart + run: | + make package-chart; + + - name: Release Chart + uses: softprops/action-gh-release@v2 + with: + files: | + deploy/* + + - name: Index Chart + run: | + make index-chart + \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..5ac8d83e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +on: + push: + tags: + - "v*" + +name: Release +permissions: + contents: write + id-token: write +jobs: + release-cross-arch: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Cross Arch Build + run: | + make ci + env: + CROSS: "true" + + - name: "Read secrets" + uses: rancher-eio/read-vault-secrets@main + 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: release binaries + uses: softprops/action-gh-release@v2 + with: + files: | + bin/* + + - name: Login to Container Registry + uses: docker/login-action@v3 + with: + username: ${{ env.DOCKER_USERNAME }} + password: ${{ env.DOCKER_PASSWORD }} + + - name: Build container image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: rancher/k3k:${{ github.ref_name }} + file: package/Dockerfile + platforms: linux/amd64 + + + \ No newline at end of file diff --git a/Makefile b/Makefile index 61318651..8dcb2fc5 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ TARGETS := $(shell ls ops) - .dapper: @echo Downloading dapper @curl -sL https://releases.rancher.com/dapper/latest/dapper-$$(uname -s)-$$(uname -m) > .dapper.tmp @@ -12,4 +11,4 @@ $(TARGETS): .dapper .DEFAULT_GOAL := default -.PHONY: $(TARGETS) +.PHONY: $(TARGETS) \ No newline at end of file diff --git a/charts/k3k/Chart.yaml b/charts/k3k/Chart.yaml index a754c50c..25600a11 100644 --- a/charts/k3k/Chart.yaml +++ b/charts/k3k/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: k3k description: A Helm chart for K3K type: application -version: 0.1.4-r1 +version: 0.1.5-r5 appVersion: 0.2.0 diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index c48ea21c..8468a450 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -4,6 +4,7 @@ set -o errexit set -o nounset set -o pipefail +set -x CODEGEN_GIT_PKG=https://github.com/kubernetes/code-generator.git git clone --depth 1 ${CODEGEN_GIT_PKG} || true diff --git a/ops/version b/ops/version index 1646092e..112eb69d 100755 --- a/ops/version +++ b/ops/version @@ -5,7 +5,7 @@ if [ -n "$(git status --porcelain --untracked-files=no)" ]; then fi COMMIT=$(git rev-parse --short HEAD) -GIT_TAG=${DRONE_TAG:-$(git tag -l --contains HEAD | head -n 1)} +GIT_TAG=${TAG:-$(git tag -l --contains HEAD | head -n 1)} if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then VERSION=$GIT_TAG @@ -19,9 +19,15 @@ fi SUFFIX="-${ARCH}" -TAG=${TAG:-${VERSION}${SUFFIX}} + +if [[ $VERSION = "chart*" ]]; then + TAG=${TAG:-${VERSION}} +else + TAG=${TAG:-${VERSION}${SUFFIX}} +fi + REPO=${REPO:-rancher} -if echo $TAG | grep -q dirty; then +if echo $TAG | grep dirty; then TAG=dev fi