From 1b06b03f751164d2fec2423ed3532ef8b8e8320b Mon Sep 17 00:00:00 2001 From: Kaizen Conroy Date: Fri, 19 Jan 2024 12:16:49 -0500 Subject: [PATCH 1/4] feat(projen): upgrade dependencies for last 3 minor versions --- .gitattributes | 2 + .../workflows/upgrade-kubectl-v26-main.yml | 91 +++++++++++++++++++ .../workflows/upgrade-kubectl-v27-main.yml | 91 +++++++++++++++++++ .gitignore | 2 + .projen/files.json | 2 + .projenrc.ts | 11 +++ CONTRIBUTING.md | 8 ++ 7 files changed, 207 insertions(+) create mode 100644 .github/workflows/upgrade-kubectl-v26-main.yml create mode 100644 .github/workflows/upgrade-kubectl-v27-main.yml diff --git a/.gitattributes b/.gitattributes index 4563d401..d3052a5f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,6 +8,8 @@ /.github/workflows/build.yml linguist-generated /.github/workflows/pull-request-lint.yml linguist-generated /.github/workflows/release-kubectl-v28.yml linguist-generated +/.github/workflows/upgrade-kubectl-v26-main.yml linguist-generated +/.github/workflows/upgrade-kubectl-v27-main.yml linguist-generated /.github/workflows/upgrade-kubectl-v28-main.yml linguist-generated /.gitignore linguist-generated /.gitpod.yml linguist-generated diff --git a/.github/workflows/upgrade-kubectl-v26-main.yml b/.github/workflows/upgrade-kubectl-v26-main.yml new file mode 100644 index 00000000..8a89b497 --- /dev/null +++ b/.github/workflows/upgrade-kubectl-v26-main.yml @@ -0,0 +1,91 @@ +# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". + +name: upgrade-kubectl-v26-main +on: + workflow_dispatch: {} + schedule: + - cron: 0 0 * * * +jobs: + upgrade: + name: Upgrade + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + patch_created: ${{ steps.create_patch.outputs.patch_created }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: kubectl-v26/main + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: Install dependencies + run: yarn install --check-files --frozen-lockfile + - name: Upgrade dependencies + run: npx projen upgrade + - name: Find mutations + id: create_patch + run: |- + git add . + git diff --staged --patch --exit-code > .repo.patch || echo "patch_created=true" >> $GITHUB_OUTPUT + - name: Upload patch + if: steps.create_patch.outputs.patch_created + uses: actions/upload-artifact@v3 + with: + name: .repo.patch + path: .repo.patch + pr: + name: Create Pull Request + needs: upgrade + runs-on: ubuntu-latest + permissions: + contents: read + if: ${{ needs.upgrade.outputs.patch_created }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: kubectl-v26/main + - name: Download patch + uses: actions/download-artifact@v3 + with: + name: .repo.patch + path: ${{ runner.temp }} + - name: Apply patch + run: '[ -s ${{ runner.temp }}/.repo.patch ] && git apply ${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."' + - name: Set git identity + run: |- + git config user.name "github-actions" + git config user.email "github-actions@github.com" + - name: Create Pull Request + id: create-pr + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.PROJEN_GITHUB_TOKEN }} + commit-message: |- + chore(deps): upgrade dependencies + + Upgrades project dependencies. See details in [workflow run]. + + [Workflow Run]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + + ------ + + *Automatically created by projen via the "upgrade-kubectl-v26-main" workflow* + branch: github-actions/upgrade-kubectl-v26-main + title: "chore(deps): upgrade dependencies" + labels: auto-approve + body: |- + Upgrades project dependencies. See details in [workflow run]. + + [Workflow Run]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + + ------ + + *Automatically created by projen via the "upgrade-kubectl-v26-main" workflow* + author: github-actions + committer: github-actions + signoff: true diff --git a/.github/workflows/upgrade-kubectl-v27-main.yml b/.github/workflows/upgrade-kubectl-v27-main.yml new file mode 100644 index 00000000..f8ed040b --- /dev/null +++ b/.github/workflows/upgrade-kubectl-v27-main.yml @@ -0,0 +1,91 @@ +# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". + +name: upgrade-kubectl-v27-main +on: + workflow_dispatch: {} + schedule: + - cron: 0 0 * * * +jobs: + upgrade: + name: Upgrade + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + patch_created: ${{ steps.create_patch.outputs.patch_created }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: kubectl-v27/main + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: Install dependencies + run: yarn install --check-files --frozen-lockfile + - name: Upgrade dependencies + run: npx projen upgrade + - name: Find mutations + id: create_patch + run: |- + git add . + git diff --staged --patch --exit-code > .repo.patch || echo "patch_created=true" >> $GITHUB_OUTPUT + - name: Upload patch + if: steps.create_patch.outputs.patch_created + uses: actions/upload-artifact@v3 + with: + name: .repo.patch + path: .repo.patch + pr: + name: Create Pull Request + needs: upgrade + runs-on: ubuntu-latest + permissions: + contents: read + if: ${{ needs.upgrade.outputs.patch_created }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: kubectl-v27/main + - name: Download patch + uses: actions/download-artifact@v3 + with: + name: .repo.patch + path: ${{ runner.temp }} + - name: Apply patch + run: '[ -s ${{ runner.temp }}/.repo.patch ] && git apply ${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."' + - name: Set git identity + run: |- + git config user.name "github-actions" + git config user.email "github-actions@github.com" + - name: Create Pull Request + id: create-pr + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.PROJEN_GITHUB_TOKEN }} + commit-message: |- + chore(deps): upgrade dependencies + + Upgrades project dependencies. See details in [workflow run]. + + [Workflow Run]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + + ------ + + *Automatically created by projen via the "upgrade-kubectl-v27-main" workflow* + branch: github-actions/upgrade-kubectl-v27-main + title: "chore(deps): upgrade dependencies" + labels: auto-approve + body: |- + Upgrades project dependencies. See details in [workflow run]. + + [Workflow Run]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + + ------ + + *Automatically created by projen via the "upgrade-kubectl-v27-main" workflow* + author: github-actions + committer: github-actions + signoff: true diff --git a/.gitignore b/.gitignore index 15da21bc..890dcd72 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,8 @@ junit.xml /dist/version.txt !/.github/workflows/release-kubectl-v28.yml !/.github/workflows/upgrade-kubectl-v28-main.yml +!/.github/workflows/upgrade-kubectl-v27-main.yml +!/.github/workflows/upgrade-kubectl-v26-main.yml !/.github/pull_request_template.md !/.npmrc !/test/ diff --git a/.projen/files.json b/.projen/files.json index 1721c76a..6b4ae9bd 100644 --- a/.projen/files.json +++ b/.projen/files.json @@ -7,6 +7,8 @@ ".github/workflows/build.yml", ".github/workflows/pull-request-lint.yml", ".github/workflows/release-kubectl-v28.yml", + ".github/workflows/upgrade-kubectl-v26-main.yml", + ".github/workflows/upgrade-kubectl-v27-main.yml", ".github/workflows/upgrade-kubectl-v28-main.yml", ".gitignore", ".gitpod.yml", diff --git a/.projenrc.ts b/.projenrc.ts index 010d42ce..eaa91078 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -21,6 +21,17 @@ const project = new awscdk.AwsCdkConstructLibrary({ secret: 'GITHUB_TOKEN', }, autoApproveUpgrades: true, + // we support the current default version and 3 prior versions just like Kubernetes + depsUpgradeOptions: { + workflowOptions: { + branches: [ + `kubectl-v${SPEC_VERSION}/main`, + `kubectl-v${Number(SPEC_VERSION)-1}/main`, + `kubectl-v${Number(SPEC_VERSION)-2}/main`, + ], + labels: ['auto-approve'], + }, + }, majorVersion: 2, npmAccess: NpmAccess.PUBLIC, releaseTagPrefix: `kubectl-v${SPEC_VERSION}`, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 10a68978..2d577178 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,13 @@ information to effectively respond to your bug report or contribution. Specifically, if you wish to contribute a new Kubectl Asset with a different kubectl version, jump to [Contributing a new Kubectl Asset](#contributing-a-new-kubectl-asset). +## Supported Versions + +Similar to [kubernetes](https://kubernetes.io/releases/), we support the most recent three minor versions. +This means that we continue to upgrade dependencies for the most recent three versions. + +We also plan to have the default branch of this repository to be the latest released version. If that is +not the case, please raise a GitHub Issue with us! ## Reporting Bugs/Feature Requests @@ -64,6 +71,7 @@ Run `npx projen integ:kubectl-layer:snapshot` if `deploy` succeeds and the snaps 7. Run `yarn build` to ensure everything builds correctly. 8. Commit to your fork and submit a pull request to the repository, _ensuring that you are targeting the correct `kubectl-vY/main` branch_. 9. A maintainer will review your contribution from there! +10. ⚠️ IMPORTANT ⚠️ The maintainer should go into the repository settings and update the default branch to the new, latest version. ## Backporting changes to branches with different Kubectl versions This repository consists of multiple branches, with each branch corresponding to a specific Kubectl version. From 5713ec6ede033f8655124eab7cb200b601533bdf Mon Sep 17 00:00:00 2001 From: Kaizen Conroy Date: Fri, 19 Jan 2024 12:17:49 -0500 Subject: [PATCH 2/4] comment --- .projenrc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.projenrc.ts b/.projenrc.ts index eaa91078..6c124c6d 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -21,7 +21,7 @@ const project = new awscdk.AwsCdkConstructLibrary({ secret: 'GITHUB_TOKEN', }, autoApproveUpgrades: true, - // we support the current default version and 3 prior versions just like Kubernetes + // @e support the last 3 minor versions just like Kubernetes depsUpgradeOptions: { workflowOptions: { branches: [ From 50a0ea45061fd11b5f12cd3268b4cbeb4a52c1ec Mon Sep 17 00:00:00 2001 From: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com> Date: Fri, 19 Jan 2024 12:18:48 -0500 Subject: [PATCH 3/4] Update .projenrc.ts --- .projenrc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.projenrc.ts b/.projenrc.ts index 6c124c6d..84d01667 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -21,7 +21,7 @@ const project = new awscdk.AwsCdkConstructLibrary({ secret: 'GITHUB_TOKEN', }, autoApproveUpgrades: true, - // @e support the last 3 minor versions just like Kubernetes + // We support the last 3 minor versions just like Kubernetes depsUpgradeOptions: { workflowOptions: { branches: [ From cca98958f163088ea9a38d643762d2bb7558f5c1 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 19 Jan 2024 17:20:11 +0000 Subject: [PATCH 4/4] chore: self mutation Signed-off-by: github-actions --- .github/workflows/upgrade-kubectl-v26-main.yml | 2 +- .github/workflows/upgrade-kubectl-v27-main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/upgrade-kubectl-v26-main.yml b/.github/workflows/upgrade-kubectl-v26-main.yml index 8a89b497..6af36394 100644 --- a/.github/workflows/upgrade-kubectl-v26-main.yml +++ b/.github/workflows/upgrade-kubectl-v26-main.yml @@ -21,7 +21,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18.x - name: Install dependencies run: yarn install --check-files --frozen-lockfile - name: Upgrade dependencies diff --git a/.github/workflows/upgrade-kubectl-v27-main.yml b/.github/workflows/upgrade-kubectl-v27-main.yml index f8ed040b..de2fdc7b 100644 --- a/.github/workflows/upgrade-kubectl-v27-main.yml +++ b/.github/workflows/upgrade-kubectl-v27-main.yml @@ -21,7 +21,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18.x - name: Install dependencies run: yarn install --check-files --frozen-lockfile - name: Upgrade dependencies