Skip to content

Routinely check for a new version of odo.#2815

Merged
rgrunber merged 1 commit intoredhat-developer:mainfrom
rgrunber:check-odo
Apr 3, 2023
Merged

Routinely check for a new version of odo.#2815
rgrunber merged 1 commit intoredhat-developer:mainfrom
rgrunber:check-odo

Conversation

@rgrunber
Copy link
Copy Markdown
Member

@rgrunber rgrunber commented Mar 30, 2023

Todo :

  • Change build trigger from workflow_dispatch (easier to test) to a schedule (daily?)
  • Confirm required permissions are in place
  • Adapt the script to also handle oc ? Though we're already pretty far behind from the latest

How to test this :
You can create a fork of vscode-openshift-tools, and push this PR onto the main branch (so that GH Actions reads the workflow file from there)

Apply something similar to the following patch (can be a separate commit on top of this PR) :

diff
diff --git a/.github/workflows/check-odo.yml b/.github/workflows/check-odo.yml
index c168612..14d007b 100644
--- a/.github/workflows/check-odo.yml
+++ b/.github/workflows/check-odo.yml
@@ -19,9 +19,9 @@ jobs:
           echo "LATEST_TOOL_URL=$(echo ${LATEST_TOOL_RELEASE_RESP} | jq -r .url)" >> $GITHUB_ENV
       - name: Find existing PR for ODO version
         run: |
-          echo PR_URL=$(gh pr --repo ${{ github.repository }} list --state all --search "update odo ${{env.LATEST_TOOL_RELEASE}} in:title" --json url) >> $GITHUB_ENV
+          echo PR_URL=$(gh pr --repo rgrunber/vscode-openshift-tools list --state all --search "update odo ${{env.LATEST_TOOL_RELEASE}} in:title" --json url) >> $GITHUB_ENV
       - name: Update src/tools.json with latest odo version
-        if: ${{ (env.LATEST_TOOL_RELEASE != env.REPO_ODO_VERSION) && (env.PR_URL == '') }}
+        if: ${{ (env.LATEST_TOOL_RELEASE != env.REPO_ODO_VERSION) && (env.PR_URL != '') }}
         run: |
           jq --indent 4 '.odo.version = "${{ env.LATEST_TOOL_RELEASE }}"' src/tools.json | jq --indent 4 '.odo.versionRange = "^${{ env.LATEST_TOOL_RELEASE }}"' | jq --indent 4 '.odo.versionRangeLabel = "version >= ${{ env.LATEST_TOOL_RELEASE }}"' > src/tools.json.new
           mv src/tools.json.new src/tools.json
@@ -33,7 +33,7 @@ jobs:
             mv src/tools.json.new src/tools.json
           done
       - name: Create pull request
-        if: ${{ (env.LATEST_TOOL_RELEASE != env.REPO_ODO_VERSION) && (env.PR_URL == '') }}
+        if: ${{ (env.LATEST_TOOL_RELEASE != env.REPO_ODO_VERSION) && (env.PR_URL != '') }}
         run: |
           git config --global user.email "openshifttools-bot@users.noreply.github.com"
           git config --global user.name "openshifttools-bot"
diff --git a/src/tools.json b/src/tools.json
index 9bb4c29..814947e 100644
--- a/src/tools.json
+++ b/src/tools.json
@@ -3,27 +3,27 @@
         "description": "odo CLI",
         "vendor": "Red Hat, Inc.",
         "name": "odo",
-        "version": "3.8.0",
-        "versionRange": "^3.8.0",
-        "versionRangeLabel": "version >= 3.8.0",
+        "version": "3.7.0",
+        "versionRange": "^3.7.0",
+        "versionRangeLabel": "version >= 3.7.0",
         "dlFileName": "odo",
         "filePrefix": "",
         "platform": {
             "win32": {
-                "url": "https://developers.redhat.com/content-gateway/rest/mirror2/pub/openshift-v4/clients/odo/v3.8.0/odo-windows-amd64.exe.zip",
-                "sha256sum": "0d33e08aa79638d306dd495ae421f9f7685acdbdcd0cc4f06ffb851c262d5437",
+                "url": "https://developers.redhat.com/content-gateway/rest/mirror2/pub/openshift-v4/clients/odo/v3.7.0/odo-windows-amd64.exe.zip",
+                "sha256sum": "0",
                 "dlFileName": "odo-windows-amd64.exe.zip",
                 "cmdFileName": "odo-windows-amd64.exe"
             },
             "darwin": {
-                "url": "https://developers.redhat.com/content-gateway/rest/mirror2/pub/openshift-v4/clients/odo/v3.8.0/odo-darwin-amd64.tar.gz",
-                "sha256sum": "cd84feb03533df0ceda3bb2e5590e7c2ec360e85f7c60a447e9ef86214171954",
+                "url": "https://developers.redhat.com/content-gateway/rest/mirror2/pub/openshift-v4/clients/odo/v3.7.0/odo-darwin-amd64.tar.gz",
+                "sha256sum": "0",
                 "dlFileName": "odo-darwin-amd64.tar.gz",
                 "cmdFileName": "odo-darwin-amd64"
             },
             "linux": {
-                "url": "https://developers.redhat.com/content-gateway/rest/mirror2/pub/openshift-v4/clients/odo/v3.8.0/odo-linux-amd64.tar.gz",
-                "sha256sum": "dc1b9e81bab3185c90e42f42e9066f298310cef5c6371242187cee9d70aa439c",
+                "url": "https://developers.redhat.com/content-gateway/rest/mirror2/pub/openshift-v4/clients/odo/v3.7.0/odo-linux-amd64.tar.gz",
+                "sha256sum": "0",
                 "dlFileName": "odo-linux-amd64.tar.gz",
                 "cmdFileName": "odo"
             }
-- 
2.39.2

Since the latest odo is currently adopted, this just simulated the case of a newer version. See rgrunber#14 for a sample

Required repo permissions :

Screenshot from 2023-03-29 22-53-33

Without full read/write permissions, the following error is displayed attempting to push the commit to a branch :

remote: Permission to rgrunber/vscode-openshift-tools.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/rgrunber/vscode-openshift-tools/': The requested URL returned error: 40

Without pull request approval for GH Actions, the following error is shown :

pull request create failed: GraphQL: GitHub Actions is not permitted to create or approve pull requests (createPullRequest)

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2023

Codecov Report

Patch coverage: 5.88% and project coverage change: +0.44 🎉

Comparison is base (895c510) 33.72% compared to head (323a25b) 34.17%.

❗ Current head 323a25b differs from pull request most recent head 627fcec. Consider uploading reports for the commit 627fcec to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2815      +/-   ##
==========================================
+ Coverage   33.72%   34.17%   +0.44%     
==========================================
  Files          70       70              
  Lines        4314     4302      -12     
  Branches      782      777       -5     
==========================================
+ Hits         1455     1470      +15     
+ Misses       2859     2832      -27     
Impacted Files Coverage Δ
src/odo/command.ts 14.28% <0.00%> (-0.28%) ⬇️
src/openshift/component.ts 15.21% <0.00%> (+0.51%) ⬆️
src/webview/log/LogViewLoader.ts 21.21% <0.00%> (+0.62%) ⬆️
src/tools.ts 88.88% <100.00%> (ø)

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment thread .github/workflows/check-odo.yml Outdated
Comment thread .github/workflows/check-odo.yml Outdated
Comment thread .github/workflows/check-odo.yml Outdated
Copy link
Copy Markdown
Collaborator

@msivasubramaniaan msivasubramaniaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread .github/workflows/check-odo.yml Outdated
Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
Copy link
Copy Markdown
Collaborator

@msivasubramaniaan msivasubramaniaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rgrunber rgrunber merged commit 4eae27f into redhat-developer:main Apr 3, 2023
@rgrunber rgrunber deleted the check-odo branch April 3, 2023 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants