diff --git a/.github/.kodiak.toml b/.github/.kodiak.toml index ded81e43d..b64a5f6fc 100644 --- a/.github/.kodiak.toml +++ b/.github/.kodiak.toml @@ -15,4 +15,4 @@ strip_html_comments = true # default: false always = true # default: false [approve] -auto_approve_usernames = ["1gtm", "tamalsaha"] +auto_approve_usernames = ["tamalsaha", "1gtm", "1gtm-app[bot]"] \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 423bbaf9e..7786ab9fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,29 +19,29 @@ jobs: runs-on: firecracker steps: - name: Set up Go 1.25 - uses: actions/setup-go@v5 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: go-version: '1.25' id: go - name: Check out code into the Go module directory - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - name: Set up QEMU id: qemu - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 with: cache-image: false - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 - - name: Login GitHub Container Registry - env: - DOCKER_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }} - USERNAME: 1gtm - run: | - docker login ghcr.io --username ${USERNAME} --password ${DOCKER_TOKEN} + - name: Login to GitHub Container Registry + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + with: + registry: ghcr.io + username: 1gtm + password: ${{ secrets.LGTM_GITHUB_TOKEN }} - name: Push Docker Image env: @@ -51,7 +51,6 @@ jobs: - name: Run checks run: | - sudo apt-get -qq update || true curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.31.0/bin/linux/amd64/kubectl chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl @@ -65,14 +64,14 @@ jobs: matrix: k8s: [v1.28.15, v1.30.13, v1.32.5, v1.34.0] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - name: Create Kubernetes ${{ matrix.k8s }} cluster id: kind - uses: engineerd/setup-kind@v0.5.0 + uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0 with: version: v0.29.0 - image: kindest/node:${{ matrix.k8s }} + node_image: kindest/node:${{ matrix.k8s }} - name: Test crds run: | diff --git a/.github/workflows/release-tracker.yml b/.github/workflows/release-tracker.yml index 4b79b251d..6be6c21ef 100644 --- a/.github/workflows/release-tracker.yml +++ b/.github/workflows/release-tracker.yml @@ -11,31 +11,25 @@ concurrency: jobs: build: + if: github.event.pull_request.merged == true runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - - name: Prepare git - env: - GITHUB_USER: 1gtm - GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }} - run: | - git config --global user.name "${GITHUB_USER}" - git config --global user.email "${GITHUB_USER}@appscode.com" - git remote set-url origin https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git - - - name: Install GitHub CLI - run: | - curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 - sudo mv bin/hub /usr/local/bin + - name: Generate LGTM App token + id: lgtm-app-token + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + client-id: ${{ secrets.LGTM_APP_CLIENT_ID }} + private-key: ${{ secrets.LGTM_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: CHANGELOG + permission-pull-requests: write - name: Update release tracker - if: | - github.event.action == 'closed' && - github.event.pull_request.merged == true env: - GITHUB_USER: 1gtm - GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }} + GITHUB_USER: ${{ github.actor }} + GITHUB_TOKEN: ${{ steps.lgtm-app-token.outputs.token }} run: | ./hack/scripts/update-release-tracker.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1f12bc6a5..c73e7ae12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,12 +14,16 @@ jobs: build: name: Build runs-on: ubuntu-24.04 + permissions: + contents: write steps: - name: Check out code into the Go module directory - uses: actions/checkout@v1 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + fetch-depth: 0 - name: Set up Go 1.25 - uses: actions/setup-go@v5 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: go-version: '1.25' id: go @@ -31,19 +35,23 @@ jobs: - name: Set up QEMU id: qemu - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 with: cache-image: false - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 + + - name: Log in to the GitHub Container registry + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + with: + registry: ghcr.io + username: 1gtm + password: ${{ secrets.LGTM_GITHUB_TOKEN }} - name: Publish to GitHub Container Registry env: REGISTRY: ghcr.io/stashed - DOCKER_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }} - USERNAME: 1gtm APPSCODE_ENV: prod run: | - docker login ghcr.io --username ${USERNAME} --password ${DOCKER_TOKEN} make release diff --git a/.github/workflows/update-crds.yaml b/.github/workflows/update-crds.yaml deleted file mode 100644 index 18e9c88d1..000000000 --- a/.github/workflows/update-crds.yaml +++ /dev/null @@ -1,58 +0,0 @@ -name: update-crds - -on: - push: - branches: - - master - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-crd - cancel-in-progress: true - -jobs: - build: - name: Build - runs-on: ubuntu-24.04 - steps: - - name: Set up Go 1.25 - uses: actions/setup-go@v5 - with: - go-version: '1.25' - id: go - - - uses: actions/checkout@v4 - - - name: Install GitHub CLI - run: | - curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 - sudo mv bin/hub /usr/local/bin - - - name: Install crd-importer - run: | - curl -L -o crd-importer https://github.com/kmodules/crd-importer/releases/download/v0.0.1/crd-importer-linux-amd64 - chmod +x ./crd-importer - sudo mv ./crd-importer /usr/local/bin/crd-importer - - - name: Clone installer repository - env: - GITHUB_USER: 1gtm - GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }} - INSTALLER_REPOSITORY: ${{ secrets.INSTALLER_REPOSITORY }} - run: | - url="https://${GITHUB_USER}:${GITHUB_TOKEN}@${INSTALLER_REPOSITORY}.git" - cd $RUNNER_WORKSPACE - git clone $url - cd $(basename $INSTALLER_REPOSITORY) - git config user.name "${GITHUB_USER}" - git config user.email "${GITHUB_USER}@appscode.com" - - - name: Update crds - env: - GITHUB_USER: 1gtm - GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }} - INSTALLER_REPOSITORY: ${{ secrets.INSTALLER_REPOSITORY }} - run: | - export INSTALLER_ROOT=$RUNNER_WORKSPACE/$(basename $INSTALLER_REPOSITORY) - $INSTALLER_ROOT/hack/scripts/import-crds.sh $(pwd)/crds - $INSTALLER_ROOT/hack/scripts/open-pr.sh diff --git a/.github/workflows/update-crds.yml b/.github/workflows/update-crds.yml new file mode 100644 index 000000000..fa05bd76f --- /dev/null +++ b/.github/workflows/update-crds.yml @@ -0,0 +1,71 @@ +name: update-crds + +on: + push: + branches: + - master + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-crd + cancel-in-progress: true + +jobs: + build: + name: Build + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + + - name: Install crd-importer + run: | + curl -L -o crd-importer https://github.com/kmodules/crd-importer/releases/download/v0.0.1/crd-importer-linux-amd64 + chmod +x ./crd-importer + sudo mv ./crd-importer /usr/local/bin/crd-importer + + - name: Parse installer repository + id: installer + env: + INSTALLER_REPOSITORY: ${{ secrets.INSTALLER_REPOSITORY }} + run: | + owner=$(basename $(dirname $INSTALLER_REPOSITORY)) + name=$(basename $INSTALLER_REPOSITORY) + echo "::add-mask::$owner" + echo "::add-mask::$name" + echo "owner=$owner" >> $GITHUB_OUTPUT + echo "name=$name" >> $GITHUB_OUTPUT + + - name: Generate LGTM App token + id: lgtm-app-token + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + client-id: ${{ secrets.LGTM_APP_CLIENT_ID }} + private-key: ${{ secrets.LGTM_APP_PRIVATE_KEY }} + owner: ${{ steps.installer.outputs.owner }} + repositories: ${{ steps.installer.outputs.name }} + permission-contents: write + permission-pull-requests: write + + - name: Clone installer repository + env: + GITHUB_USER: 1gtm + GITHUB_TOKEN: ${{ steps.lgtm-app-token.outputs.token }} + INSTALLER_REPOSITORY: ${{ secrets.INSTALLER_REPOSITORY }} + run: | + git config --global http.https://github.com/.extraheader \ + "AUTHORIZATION: basic $(echo -n x-access-token:${GITHUB_TOKEN} | base64)" + cd $RUNNER_WORKSPACE + git clone "https://${INSTALLER_REPOSITORY}.git" + cd $(basename $INSTALLER_REPOSITORY) + git config user.name "1gtm" + git config user.email "1gtm@appscode.com" + + - name: Update crds + env: + GITHUB_USER: 1gtm + GITHUB_TOKEN: ${{ steps.lgtm-app-token.outputs.token }} + INSTALLER_REPOSITORY: ${{ secrets.INSTALLER_REPOSITORY }} + run: | + export INSTALLER_ROOT=$RUNNER_WORKSPACE/$(basename $INSTALLER_REPOSITORY) + $INSTALLER_ROOT/hack/scripts/import-crds.sh $(pwd)/crds + $INSTALLER_ROOT/hack/scripts/open-pr.sh diff --git a/Makefile b/Makefile index 976647dee..c1baa93f2 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ API_GROUPS ?= repositories:v1alpha1 stash:v1alpha1 stash:v1beta1 ui:v1 # This version-strategy uses git tags to set the version string git_branch := $(shell git rev-parse --abbrev-ref HEAD) -git_tag := $(shell git describe --exact-match --abbrev=0 2>/dev/null || echo "") +git_tag := $(shell git describe --tags --exact-match --abbrev=0 2>/dev/null || echo "") commit_hash := $(shell git rev-parse --verify HEAD) commit_timestamp := $(shell date --date="@$$(git show -s --format=%ct)" --utc +%FT%T) diff --git a/hack/scripts/update-release-tracker.sh b/hack/scripts/update-release-tracker.sh index 7184cb6fe..c8bfc4ff2 100755 --- a/hack/scripts/update-release-tracker.sh +++ b/hack/scripts/update-release-tracker.sh @@ -69,4 +69,4 @@ case $GITHUB_BASE_REF in ;; esac -hub api "$api_url" -f body="$msg" +gh api "$api_url" -f body="$msg"