From 42706d467d30ad9cf20ec3dcc9854784015a16e8 Mon Sep 17 00:00:00 2001 From: Olivier Vernin Date: Mon, 22 Jul 2024 17:46:13 +0200 Subject: [PATCH 1/3] Use GitHub Token default environment variable * use Updatecli github action to install Updatecli * Use GitHub action environment variable to reuse GitHub token Signed-off-by: Olivier Vernin --- .github/workflows/helm-update.yaml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/helm-update.yaml b/.github/workflows/helm-update.yaml index 0ed30c3..dbf7494 100644 --- a/.github/workflows/helm-update.yaml +++ b/.github/workflows/helm-update.yaml @@ -17,14 +17,13 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install updatecli - run: | - sudo apt-get update -y - sudo curl -LO https://github.com/updatecli/updatecli/releases/download/v0.80.0/updatecli_Linux_x86_64.tar.gz - sudo tar -zxvf updatecli_Linux_x86_64.tar.gz - sudo mv updatecli /usr/local/bin - updatecli version + - name: Install Updatecli in the runner + uses: updatecli/updatecli-action@v2 - name: Run updatecli run: | - updatecli apply --config updatecli.d/updatecli.yaml --debug + updatecli apply --config updatecli.d + env: + # Using the default GitHub Token means we have 1000 api requests per hour + UPDATECLI_GITHUB_ACTOR: ${{ github.actor }} + UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 8596c2673625805b250db35434217c23a49e4bcc Mon Sep 17 00:00:00 2001 From: Olivier Vernin Date: Mon, 22 Jul 2024 17:48:21 +0200 Subject: [PATCH 2/3] Add basic commands to README.md Signed-off-by: Olivier Vernin --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 6f84019..bc01e18 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,10 @@ # updatecli-PR updatecli-PR + +To run this updatecli script, you can run the following commands: + +``` +export UPDATECLI_GITHUB_ACTOR=akash911133 +export UPDATECLI_GITHUB_TOKEN=ghx_xxxx +updatecli compose apply --file .github/updatecli/update-compose.yaml +updatecli apply --config updatecli.d From bffd4375644fc525a7b39c8ab880a042644337e5 Mon Sep 17 00:00:00 2001 From: Olivier Vernin Date: Mon, 22 Jul 2024 17:48:53 +0200 Subject: [PATCH 3/3] fix updatecli manifest Signed-off-by: Olivier Vernin --- updatecli.d/updatecli.yaml | 41 +++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/updatecli.d/updatecli.yaml b/updatecli.d/updatecli.yaml index 830b015..4f56cee 100644 --- a/updatecli.d/updatecli.yaml +++ b/updatecli.d/updatecli.yaml @@ -1,52 +1,47 @@ # updatecli.yaml -name: Update a file content and open a GitHub Pull Request +name: "deps: update cluster-autoscaler version in input.tf" scms: default: kind: "github" - id: default spec: user: "Akash Ughade" email: "akashughade77@gmail.com" owner: "akash911133" repository: "updatecli-PR" - token: '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' - username: 'akash911133' + token: '{{ requiredEnv "UPDATECLI_GITHUB_TOKEN" }}' + username: '{{ requiredEnv "UPDATECLI_GITHUB_ACTOR" }}' branch: "main" commitmessage: - type: "feat" - title: "Updating version of helm chart" - body: "updated latest version in data.yaml" hidecredit: true actions: default: kind: "github/pullrequest" - scmid: default - target: - - chart-cluster-autoscaler + scmid: "default" spec: automerge: false - description: "Creating a pull request 1" draft: true labels: - - "Dependencies" + - "dependencies" title: "Update git_repo_scanner helm chart version" sources: chart-cluster-autoscaler: - kind: helmchart - pattern: "*" + name: "Get the latest version of cluster-autoscaler helm chart" + kind: "helmchart" spec: - name: cluster-autoscaler - url: https://kubernetes.github.io/autoscaler - version: latest + name: "cluster-autoscaler" + url: "https://kubernetes.github.io/autoscaler" + versionfilter: + kind: "semver" + pattern: "*" targets: chart-cluster-autoscaler: - name: Update cluster-autoscaler version in input.tf - kind: terraform/file - sourceid: chart-cluster-autoscaler - scmid: default + name: 'deps: update cluster-autoscaler version in input.tf to {{ source "chart-cluster-autoscaler" }}' + kind: "terraform/file" + sourceid: "chart-cluster-autoscaler" + scmid: "default" spec: - file: ../templates/eks/input.tf - path: variable.CLUSTER_AUTOSCALER_HELM_CHART_VERSION.default + file: "templates/eks/input.tf" + path: "variable.CLUSTER_AUTOSCALER_HELM_CHART_VERSION.default"