From 86b1a1e2b409fd943d97cc939971aef71d78e926 Mon Sep 17 00:00:00 2001 From: "Marlon (Esolitos) Saglia" Date: Fri, 23 Aug 2024 10:12:25 +0200 Subject: [PATCH 1/3] fix(CI): use the correct version for VespaCLI publishing --- .github/workflows/publish-cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml index 0aa7faa2bfd9..20eca473d30c 100644 --- a/.github/workflows/publish-cli.yml +++ b/.github/workflows/publish-cli.yml @@ -82,7 +82,7 @@ jobs: working-directory: client/go env: - VERSION: ${{ needs.prepare.outputs.version }} + VERSION: ${{ needs.prepare.outputs.build-version }} steps: - uses: actions/checkout@v4 From 8fb9f0297152cebbb3dd514f9fec318c9ff52663 Mon Sep 17 00:00:00 2001 From: Marlon Saglia Date: Fri, 23 Aug 2024 14:08:48 +0200 Subject: [PATCH 2/3] fix(CI): ensure request to Github API are authenticated --- client/go/cond_make.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client/go/cond_make.go b/client/go/cond_make.go index 6be1c012063c..514e86c63bf8 100644 --- a/client/go/cond_make.go +++ b/client/go/cond_make.go @@ -86,7 +86,16 @@ func latestReleasedTag(mirror string) (string, error) { switch mirror { case "github": url := "https://api.github.com/repos/vespa-engine/vespa/releases/latest" - resp, err := http.Get(url) + token := "Bearer " + os.Getenv("GH_TOKEN") + + req, err := http.NewRequest("GET", url, nil) + if err != nil { + log.Println("Error on setting up http request.\n[ERROR] -", err) + } + req.Header.Add("Authorization", token) + + client := &http.Client{} + resp, err := client.Do(req) if err != nil { return "", err } @@ -100,6 +109,7 @@ func latestReleasedTag(mirror string) (string, error) { return "", err } return release.TagName, nil + case "homebrew": cmd, stdout, _ := newCmd("brew", "info", "--json", "--formula", "vespa-cli") cmd.Stdout = stdout // skip printing output to os.Stdout From e6b49911af3a9bc3ec5ab01cc927f33b341a3072 Mon Sep 17 00:00:00 2001 From: Marlon Saglia Date: Fri, 23 Aug 2024 14:22:27 +0200 Subject: [PATCH 3/3] fix(CI): ensure the workflow has the required permission --- .github/workflows/publish-cli.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml index 20eca473d30c..72ff037a071a 100644 --- a/.github/workflows/publish-cli.yml +++ b/.github/workflows/publish-cli.yml @@ -76,6 +76,9 @@ jobs: - prepare - build-test + permissions: + contents: write + defaults: run: # This workflow only interacts with the client/go directory, so we can set the working directory here.