From 632ea1fd66e84769c637a75016a69d6278323a26 Mon Sep 17 00:00:00 2001 From: Flora Thiebaut Date: Fri, 11 Oct 2024 11:15:51 +0200 Subject: [PATCH 1/6] build: update the codeql workflow --- .github/workflows/codeql-analysis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1495b648..f46d4d7d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -33,11 +33,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: go # If you wish to specify custom queries, you can do so here or in a config file. @@ -48,7 +48,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # â„šī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -62,4 +62,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 From b9ce77efffa53c8cbb3341066b49e24240f50b6d Mon Sep 17 00:00:00 2001 From: Flora Thiebaut Date: Fri, 11 Oct 2024 11:18:49 +0200 Subject: [PATCH 2/6] update more --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f46d4d7d..080a1d3e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,7 +37,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: go # If you wish to specify custom queries, you can do so here or in a config file. @@ -48,7 +48,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # â„šī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -62,4 +62,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 From 0f20fb28102fc02e6558f4ed9209e7f749903540 Mon Sep 17 00:00:00 2001 From: Flora Thiebaut Date: Fri, 11 Oct 2024 11:27:39 +0200 Subject: [PATCH 3/6] update ci.yml --- .github/workflows/ci.yml | 13 +++++++++++++ Makefile | 8 +++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2304d3d1..ca856c8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,19 @@ on: push: jobs: + style-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 1.21 + - name: Format + run: | + if [ "$(make check_format | wc -l)" ] -gt 0]; then + exit 1 + fi + test: runs-on: ubuntu-latest steps: diff --git a/Makefile b/Makefile index 1ca5a620..fa053a9e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ PKG_NAME=github.com/SwissDataScienceCenter/renku-gateway -.PHONY: build clean tests format +.PHONY: build clean tests format check_format tidy build: internal/login/spec.gen.go go mod download @@ -20,3 +20,9 @@ internal/login/spec.gen.go: apispec.yaml format: gofmt -l -w cmd internal tools + +check_format: + gofmt -l cmd internal tools + +tidy: + go mod tidy -e From fdad1cc0250452b2ab10796089f1c47373595dd1 Mon Sep 17 00:00:00 2001 From: Flora Thiebaut Date: Fri, 11 Oct 2024 11:34:26 +0200 Subject: [PATCH 4/6] fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca856c8f..58271e98 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: go-version: 1.21 - name: Format run: | - if [ "$(make check_format | wc -l)" ] -gt 0]; then + if [ "$(make check_format | wc -l)" -gt 0]; then exit 1 fi From 43d7a8224fa80cc00cdbbdf8a5ee83f86e416281 Mon Sep 17 00:00:00 2001 From: Flora Thiebaut Date: Fri, 11 Oct 2024 11:39:37 +0200 Subject: [PATCH 5/6] fix? --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58271e98..2522625e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: go-version: 1.21 - name: Format run: | - if [ "$(make check_format | wc -l)" -gt 0]; then + if [[ "$(make check_format | wc -l)" -gt 0 ]]; then exit 1 fi From 6f329572087a4b2acfbf14275510c1bb151b7350 Mon Sep 17 00:00:00 2001 From: Flora Thiebaut Date: Fri, 11 Oct 2024 11:40:25 +0200 Subject: [PATCH 6/6] fix format files --- internal/revproxy/main_test.go | 2 +- internal/revproxy/middlewares.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/revproxy/main_test.go b/internal/revproxy/main_test.go index 02bd2ddd..c2b2d859 100644 --- a/internal/revproxy/main_test.go +++ b/internal/revproxy/main_test.go @@ -1020,7 +1020,7 @@ func TestInternalSvcRoutes(t *testing.T) { { Path: "/ui-server/api/data/repositories/https%3A%2F%2Fexample.org%2Fgroup%2Frepo", Expected: TestResults{ - Path: "/api/data/repositories/https%3A%2F%2Fexample.org%2Fgroup%2Frepo", + Path: "/api/data/repositories/https%3A%2F%2Fexample.org%2Fgroup%2Frepo", VisitedServerIDs: []string{"upstream"}, }, }, diff --git a/internal/revproxy/middlewares.go b/internal/revproxy/middlewares.go index 1e1c4112..97fe40aa 100644 --- a/internal/revproxy/middlewares.go +++ b/internal/revproxy/middlewares.go @@ -255,7 +255,7 @@ func notebooksAnonymousID(sessions *sessions.SessionStore) echo.MiddlewareFunc { // NOTE: The anonymous session ID must start with a letter, otherwise when we use it to create sessions in k8s // things fail because a label value must start with a letter. That is why we add `anon-` here to the value. // Note that valid values for a label in k8s are [a-zA-Z0-9], also -_. and it must start with a letter. - c.Request().Header.Set("Renku-Auth-Anon-Id", "anon-" + session.ID) + c.Request().Header.Set("Renku-Auth-Anon-Id", "anon-"+session.ID) return next(c) } }