diff --git a/.github/actions/cache-cloud-provider-kind-image/action.yml b/.github/actions/cache-cloud-provider-kind-image/action.yml deleted file mode 100644 index ce095df..0000000 --- a/.github/actions/cache-cloud-provider-kind-image/action.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Cache cloud-provider-kind image -description: Checks out, builds, and caches the cloud-provider-kind image - -runs: - using: composite - steps: - - name: Checkout cloud-provider-kind repo - uses: actions/checkout@v4 - with: - repository: kubernetes-sigs/cloud-provider-kind - path: cloud-provider-kind - - - name: Generate cloud-provider-kind image cache key - id: cloud-provider-kind-cache-key - shell: bash - run: echo "hash=$(cd cloud-provider-kind && git rev-parse HEAD)" >> $GITHUB_OUTPUT - - - name: Cache cloud-provider-kind image - id: cloud-provider-kind-cache - uses: actions/cache@v3 - with: - path: /tmp/cloud-provider-kind-image - key: cloud-provider-kind-${{ steps.cloud-provider-kind-cache-key.outputs.hash }} - - - name: Load cached image - if: steps.cloud-provider-kind-cache.outputs.cache-hit == 'true' - shell: bash - run: docker load < /tmp/cloud-provider-kind-image - - - name: Set up Docker Buildx - if: steps.cloud-provider-kind-cache.outputs.cache-hit != 'true' - uses: docker/setup-buildx-action@v3 - - - name: Build cloud-provider-kind image - if: steps.cloud-provider-kind-cache.outputs.cache-hit != 'true' - uses: docker/build-push-action@v6 - with: - context: ./cloud-provider-kind - push: false - tags: cloud-provider-kind-cloud-provider:latest - load: true - cache-from: type=gha - cache-to: type=gha,mode=max - outputs: type=docker,dest=/tmp/cloud-provider-kind-image - env: - DOCKER_BUILD_RECORD_UPLOAD: "false" diff --git a/.github/release-drafter-config.yml b/.github/release-drafter-config.yml new file mode 100644 index 0000000..fe1a5c8 --- /dev/null +++ b/.github/release-drafter-config.yml @@ -0,0 +1,59 @@ +name-template: "v$RESOLVED_VERSION" +tag-template: "v$RESOLVED_VERSION" +categories: + - title: "🚀 Features" + labels: + - "feat" + - "feature" + - "enhancement" + - title: "🐛 Bug Fixes" + labels: + - "fix" + - "bugfix" + - "bug" + - title: "🧰 Maintenance" + labels: + - "chore" + - title: "💥 Breaking Changes" + labels: + - "breaking" + +change-template: "- $TITLE @$AUTHOR (#$NUMBER)" +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - "major" + - "breaking" + minor: + labels: + - "minor" + patch: + labels: + - "patch" + default: patch +template: | + ## Changes + + $CHANGES + +autolabeler: + - label: "chore" + files: + - "*.md" + title: + - "/^docs!?:/i" + - "/^test!?:/i" + - "/^chore!?:/i" + - "/^refactor!?:/i" + - label: "bug" + title: + - "/^fix!?:/i" + - "/^revert!?:/i" + - label: "feature" + title: + - "/^feat!?:/i" + - "/^add!?:/i" + - label: "breaking" + title: + - "/^[a-zA-Z]+!:/i" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f14f670..ead95de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,8 +33,5 @@ jobs: uses: actions/setup-go@v5 with: go-version-file: go.mod - - name: Install dependencies - run: | - go mod download - name: Build and run tests with race detector enabled - run: just test-race + run: just test-race \ No newline at end of file diff --git a/.github/workflows/govulncheck.yml b/.github/workflows/govulncheck.yml index 80abe98..e5ed099 100644 --- a/.github/workflows/govulncheck.yml +++ b/.github/workflows/govulncheck.yml @@ -15,9 +15,6 @@ jobs: uses: actions/setup-go@v5 with: go-version-file: go.mod - - name: Install dependencies - run: | - go mod download - id: govulncheck uses: golang/govulncheck-action@v1 with: diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 8a5dc20..7f5d4cd 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -24,9 +24,6 @@ jobs: - name: Build and run tests run: just build - - name: Build and cache cloud-provider-kind image - uses: ./.github/actions/cache-cloud-provider-kind-image - - name: Install kind run: just install-kind @@ -64,9 +61,6 @@ jobs: - name: Build and run tests run: just build - - - name: Build and cache cloud-provider-kind image - uses: ./.github/actions/cache-cloud-provider-kind-image - name: Build and install test plugin run: just install-test-plugin diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..02f2cba --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,22 @@ +name: Release Drafter +on: + push: + branches: + - main + pull_request: + types: [opened, reopened, synchronize] +permissions: + contents: read +jobs: + update_release_draft: + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v6 + with: + config-name: release-drafter-config.yml + publish: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2d8dfa4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: pre-release-binaries +on: + push: + tags: + - "v*.*.*" + +jobs: + publish: + name: Build and Publish + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' + strategy: + matrix: + goos: [linux, darwin] + goarch: [amd64, arm64] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Build + run: | + mkdir -p dist + GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/cofidectl-${{ matrix.goos }}-${{ matrix.goarch }}-${{ github.ref_name }} ./cmd/cofidectl/main.go + - name: Upload artifacts + run: | + gh release list --limit 1 | grep -q ${{ github.ref_name }} || gh release create ${{ github.ref_name }} -d + gh release upload ${{ github.ref_name }} dist/cofidectl-${{ matrix.goos }}-${{ matrix.goarch }} --clobber + gh release upload ${{ github.ref_name }} LICENSE --clobber + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/go.mod b/go.mod index cc77cb0..b3aa315 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/cofide/cofidectl go 1.23.0 -toolchain go1.23.4 +toolchain go1.23.6 require ( buf.build/go/protoyaml v0.3.1 diff --git a/tests/integration/create-kind-cluster.sh b/tests/integration/create-kind-cluster.sh index 8b1e60a..5b6868b 100755 --- a/tests/integration/create-kind-cluster.sh +++ b/tests/integration/create-kind-cluster.sh @@ -8,7 +8,7 @@ DELETE_EXISTING_KIND_CLUSTER=${DELETE_EXISTING_KIND_CLUSTER:-true} K8S_CLUSTER_NAME=${K8S_CLUSTER_NAME:-local1} -CLOUD_PROVIDER_KIND_CONTAINER_NAME=cloud-provider-kind-cloud-provider-1 +CLOUD_PROVIDER_KIND_CONTAINER_NAME=cloud-provider-kind function delete_kind_cluster() { cluster=$(kind get clusters | egrep "\b${K8S_CLUSTER_NAME}\b" || true) diff --git a/tests/integration/install-kind.sh b/tests/integration/install-kind.sh index 0c2d7ac..2591121 100755 --- a/tests/integration/install-kind.sh +++ b/tests/integration/install-kind.sh @@ -59,14 +59,13 @@ function ensure_kind_network() { fi } -function install_cloud_provider_kind() { - # https://github.com/kubernetes-sigs/cloud-provider-kind - if [[ ! -d cloud-provider-kind ]]; then - git clone --depth 1 https://github.com/kubernetes-sigs/cloud-provider-kind - fi - pushd cloud-provider-kind - sudo bash -c 'NET_MODE=kind docker compose up -d' - popd +function run_cloud_provider_kind() { + docker run -d \ + --network kind \ + --restart unless-stopped \ + --name cloud-provider-kind \ + -v /var/run/docker.sock:/var/run/docker.sock \ + registry.k8s.io/cloud-provider-kind/cloud-controller-manager:v0.5.0 } function check_non_root_docker_access() { @@ -82,7 +81,7 @@ function main() { install_kind set_inotify_limits_for_kind ensure_kind_network - install_cloud_provider_kind + run_cloud_provider_kind echo "Success!" check_non_root_docker_access }