From 60d4e559e9e8ede4953ef537106000a7d05167eb Mon Sep 17 00:00:00 2001 From: Noor Eldeen Mansour Date: Thu, 19 Mar 2026 12:33:34 +0200 Subject: [PATCH 1/2] refactor: update `ubuntu/authd` paths to `canonical/authd` --- README.md | 4 ++-- .../cmd/authd-oidc/daemon/config.go | 2 +- .../cmd/authd-oidc/daemon/daemon.go | 2 +- authd-oidc-brokers/cmd/authd-oidc/main.go | 2 +- authd-oidc-brokers/go.mod | 8 ++++++-- authd-oidc-brokers/go.sum | 7 ++----- authd-oidc-brokers/internal/broker/broker.go | 2 +- .../internal/broker/broker_test.go | 2 +- authd-oidc-brokers/internal/broker/encrypt.go | 2 +- authd-oidc-brokers/internal/consts/consts.go | 2 +- authd-oidc-brokers/internal/daemon/daemon.go | 2 +- .../internal/dbusservice/methods.go | 2 +- .../msentraid/himmelblau/himmelblau.go | 2 +- .../msentraid/himmelblau/himmelblau_c.go | 2 +- .../internal/providers/msentraid/msentraid.go | 2 +- .../providers/msentraid/msentraid_test.go | 2 +- .../internal/testutils/provider.go | 2 +- snap/variants/google/snapcraft.yaml | 17 ++++++++++------- snap/variants/msentraid/snapcraft.yaml | 17 ++++++++++------- snap/variants/oidc/snapcraft.yaml | 9 +++++++-- 20 files changed, 51 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 8b45ebe440..1580a7fe9d 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ [license-image]: https://img.shields.io/badge/License-GPL3.0-blue.svg -[codecov-image]: https://codecov.io/gh/ubuntu/authd/graph/badge.svg -[codecov-url]: https://codecov.io/gh/ubuntu/authd +[codecov-image]: https://codecov.io/gh/canonical/authd/graph/badge.svg +[codecov-url]: https://codecov.io/gh/canonical/authd [reference-documentation-image]: https://pkg.go.dev/badge/github.com/canonical/authd.svg [reference-documentation-url]: https://pkg.go.dev/github.com/canonical/authd diff --git a/authd-oidc-brokers/cmd/authd-oidc/daemon/config.go b/authd-oidc-brokers/cmd/authd-oidc/daemon/config.go index 795df3a4b0..934baf4b7d 100644 --- a/authd-oidc-brokers/cmd/authd-oidc/daemon/config.go +++ b/authd-oidc-brokers/cmd/authd-oidc/daemon/config.go @@ -9,9 +9,9 @@ import ( "strings" "github.com/canonical/authd/authd-oidc-brokers/internal/consts" + "github.com/canonical/authd/log" "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/ubuntu/authd/log" "github.com/ubuntu/decorate" ) diff --git a/authd-oidc-brokers/cmd/authd-oidc/daemon/daemon.go b/authd-oidc-brokers/cmd/authd-oidc/daemon/daemon.go index 318352f892..8d80953e3d 100644 --- a/authd-oidc-brokers/cmd/authd-oidc/daemon/daemon.go +++ b/authd-oidc-brokers/cmd/authd-oidc/daemon/daemon.go @@ -12,9 +12,9 @@ import ( "github.com/canonical/authd/authd-oidc-brokers/internal/consts" "github.com/canonical/authd/authd-oidc-brokers/internal/daemon" "github.com/canonical/authd/authd-oidc-brokers/internal/dbusservice" + log "github.com/canonical/authd/log" "github.com/spf13/cobra" "github.com/spf13/viper" - log "github.com/ubuntu/authd/log" ) // App encapsulate commands and options of the daemon, which can be controlled by env variables and config files. diff --git a/authd-oidc-brokers/cmd/authd-oidc/main.go b/authd-oidc-brokers/cmd/authd-oidc/main.go index 14f520e682..ec91b5ce69 100644 --- a/authd-oidc-brokers/cmd/authd-oidc/main.go +++ b/authd-oidc-brokers/cmd/authd-oidc/main.go @@ -12,7 +12,7 @@ import ( "github.com/canonical/authd/authd-oidc-brokers/cmd/authd-oidc/daemon" "github.com/canonical/authd/authd-oidc-brokers/internal/consts" "github.com/canonical/authd/authd-oidc-brokers/po" - "github.com/ubuntu/authd/log" + "github.com/canonical/authd/log" "github.com/ubuntu/go-i18n" ) diff --git a/authd-oidc-brokers/go.mod b/authd-oidc-brokers/go.mod index 1ce03a7bd2..839de778a1 100644 --- a/authd-oidc-brokers/go.mod +++ b/authd-oidc-brokers/go.mod @@ -6,6 +6,7 @@ toolchain go1.25.8 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 + github.com/canonical/authd v0.5.10 github.com/coreos/go-oidc/v3 v3.17.0 github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf github.com/go-jose/go-jose/v4 v4.1.3 @@ -20,7 +21,6 @@ require ( github.com/spf13/cobra v1.10.2 github.com/spf13/viper v1.21.0 github.com/stretchr/testify v1.11.1 - github.com/ubuntu/authd v0.5.10 github.com/ubuntu/decorate v0.0.0-20240301153420-5015d6dbc8e5 github.com/ubuntu/go-i18n v0.0.0-20231113092927-594c1754ca47 golang.org/x/crypto v0.49.0 @@ -31,7 +31,7 @@ require ( require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/coreos/go-systemd/v22 v22.7.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-logr/logr v1.4.3 // indirect @@ -69,3 +69,7 @@ require ( golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect ) + +// Temporary until a release tag exists whose go.mod declares module github.com/canonical/authd. +// TODO: Remove replace after that release and update the required version. +replace github.com/canonical/authd => ../ diff --git a/authd-oidc-brokers/go.sum b/authd-oidc-brokers/go.sum index dee3b30909..39aba46d69 100644 --- a/authd-oidc-brokers/go.sum +++ b/authd-oidc-brokers/go.sum @@ -6,8 +6,8 @@ github.com/coreos/go-oidc/v3 v3.17.0 h1:hWBGaQfbi0iVviX4ibC7bk8OKT5qNr4klBaCHVNv github.com/coreos/go-oidc/v3 v3.17.0/go.mod h1:wqPbKFrVnE90vty060SB40FCJ8fTHTxSwyXJqZH+sI8= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA= +github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -26,7 +26,6 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ= github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= @@ -112,8 +111,6 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/ubuntu/authd v0.5.10 h1:G0KCgHxNIlmHUadpMlGHfnHIIG3A572w29iFksmKlvs= -github.com/ubuntu/authd v0.5.10/go.mod h1:cdBi1Q4sclrTvG8VzOt+delxHcgQrzsYdK2MUoRQUYk= github.com/ubuntu/decorate v0.0.0-20240301153420-5015d6dbc8e5 h1:qO8m+4mLbo1HRpD5lfhEfr7R1PuqZvbAmjaRzYEy+tM= github.com/ubuntu/decorate v0.0.0-20240301153420-5015d6dbc8e5/go.mod h1:PUpwIgUuCQyuCz/gwiq6WYbo7IvtXXd8JqL01ez+jZE= github.com/ubuntu/go-i18n v0.0.0-20231113092927-594c1754ca47 h1:CA2dVorxvzdsGtszqhSjyvkrXxZi4bS52ZKvP0Ko634= diff --git a/authd-oidc-brokers/internal/broker/broker.go b/authd-oidc-brokers/internal/broker/broker.go index 2dee4139b5..55faea01ea 100644 --- a/authd-oidc-brokers/internal/broker/broker.go +++ b/authd-oidc-brokers/internal/broker/broker.go @@ -26,9 +26,9 @@ import ( "github.com/canonical/authd/authd-oidc-brokers/internal/providers/info" "github.com/canonical/authd/authd-oidc-brokers/internal/providers/msentraid/himmelblau" "github.com/canonical/authd/authd-oidc-brokers/internal/token" + "github.com/canonical/authd/log" "github.com/coreos/go-oidc/v3/oidc" "github.com/google/uuid" - "github.com/ubuntu/authd/log" "github.com/ubuntu/decorate" "golang.org/x/oauth2" ) diff --git a/authd-oidc-brokers/internal/broker/broker_test.go b/authd-oidc-brokers/internal/broker/broker_test.go index 3cc46b7cbe..441140d1ac 100644 --- a/authd-oidc-brokers/internal/broker/broker_test.go +++ b/authd-oidc-brokers/internal/broker/broker_test.go @@ -18,8 +18,8 @@ import ( "github.com/canonical/authd/authd-oidc-brokers/internal/providers/info" "github.com/canonical/authd/authd-oidc-brokers/internal/testutils" "github.com/canonical/authd/authd-oidc-brokers/internal/testutils/golden" + "github.com/canonical/authd/log" "github.com/stretchr/testify/require" - "github.com/ubuntu/authd/log" "gopkg.in/yaml.v3" ) diff --git a/authd-oidc-brokers/internal/broker/encrypt.go b/authd-oidc-brokers/internal/broker/encrypt.go index 5163d1b25e..82e8ddc2c1 100644 --- a/authd-oidc-brokers/internal/broker/encrypt.go +++ b/authd-oidc-brokers/internal/broker/encrypt.go @@ -8,7 +8,7 @@ import ( "errors" "fmt" - "github.com/ubuntu/authd/log" + "github.com/canonical/authd/log" ) // decodeRawSecret extract the base64 secret and try to decrypt it with the private key. diff --git a/authd-oidc-brokers/internal/consts/consts.go b/authd-oidc-brokers/internal/consts/consts.go index 0d04593cf6..ed4fbb5f7f 100644 --- a/authd-oidc-brokers/internal/consts/consts.go +++ b/authd-oidc-brokers/internal/consts/consts.go @@ -2,8 +2,8 @@ package consts import ( + "github.com/canonical/authd/log" "github.com/coreos/go-oidc/v3/oidc" - "github.com/ubuntu/authd/log" ) var ( diff --git a/authd-oidc-brokers/internal/daemon/daemon.go b/authd-oidc-brokers/internal/daemon/daemon.go index 50082d620c..01dc0b3f17 100644 --- a/authd-oidc-brokers/internal/daemon/daemon.go +++ b/authd-oidc-brokers/internal/daemon/daemon.go @@ -5,8 +5,8 @@ import ( "context" "fmt" + "github.com/canonical/authd/log" "github.com/coreos/go-systemd/daemon" - "github.com/ubuntu/authd/log" "github.com/ubuntu/decorate" ) diff --git a/authd-oidc-brokers/internal/dbusservice/methods.go b/authd-oidc-brokers/internal/dbusservice/methods.go index 3a12774694..a26b490a06 100644 --- a/authd-oidc-brokers/internal/dbusservice/methods.go +++ b/authd-oidc-brokers/internal/dbusservice/methods.go @@ -5,8 +5,8 @@ import ( "errors" "github.com/canonical/authd/authd-oidc-brokers/internal/broker" + "github.com/canonical/authd/log" "github.com/godbus/dbus/v5" - "github.com/ubuntu/authd/log" ) // NewSession is the method through which the broker and the daemon will communicate once dbusInterface.NewSession is called. diff --git a/authd-oidc-brokers/internal/providers/msentraid/himmelblau/himmelblau.go b/authd-oidc-brokers/internal/providers/msentraid/himmelblau/himmelblau.go index 722599c9bd..ca126d78b7 100644 --- a/authd-oidc-brokers/internal/providers/msentraid/himmelblau/himmelblau.go +++ b/authd-oidc-brokers/internal/providers/msentraid/himmelblau/himmelblau.go @@ -11,7 +11,7 @@ import ( "strings" "sync" - "github.com/ubuntu/authd/log" + "github.com/canonical/authd/log" "golang.org/x/oauth2" ) diff --git a/authd-oidc-brokers/internal/providers/msentraid/himmelblau/himmelblau_c.go b/authd-oidc-brokers/internal/providers/msentraid/himmelblau/himmelblau_c.go index d45e064470..5af2c712b9 100644 --- a/authd-oidc-brokers/internal/providers/msentraid/himmelblau/himmelblau_c.go +++ b/authd-oidc-brokers/internal/providers/msentraid/himmelblau/himmelblau_c.go @@ -20,7 +20,7 @@ import ( "strings" "unsafe" - "github.com/ubuntu/authd/log" + "github.com/canonical/authd/log" ) // Entra AADSTS error codes as defined in diff --git a/authd-oidc-brokers/internal/providers/msentraid/msentraid.go b/authd-oidc-brokers/internal/providers/msentraid/msentraid.go index b03a2fdcb8..07589fdd32 100644 --- a/authd-oidc-brokers/internal/providers/msentraid/msentraid.go +++ b/authd-oidc-brokers/internal/providers/msentraid/msentraid.go @@ -20,13 +20,13 @@ import ( providerErrors "github.com/canonical/authd/authd-oidc-brokers/internal/providers/errors" "github.com/canonical/authd/authd-oidc-brokers/internal/providers/info" "github.com/canonical/authd/authd-oidc-brokers/internal/providers/msentraid/himmelblau" + "github.com/canonical/authd/log" "github.com/coreos/go-oidc/v3/oidc" "github.com/golang-jwt/jwt/v5" "github.com/k0kubun/pp" msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" msgraphauth "github.com/microsoftgraph/msgraph-sdk-go-core/authentication" msgraphmodels "github.com/microsoftgraph/msgraph-sdk-go/models" - "github.com/ubuntu/authd/log" "golang.org/x/oauth2" ) diff --git a/authd-oidc-brokers/internal/providers/msentraid/msentraid_test.go b/authd-oidc-brokers/internal/providers/msentraid/msentraid_test.go index 673c234c01..07dea2c656 100644 --- a/authd-oidc-brokers/internal/providers/msentraid/msentraid_test.go +++ b/authd-oidc-brokers/internal/providers/msentraid/msentraid_test.go @@ -18,9 +18,9 @@ import ( "github.com/canonical/authd/authd-oidc-brokers/internal/providers/msentraid/himmelblau" "github.com/canonical/authd/authd-oidc-brokers/internal/testutils" "github.com/canonical/authd/authd-oidc-brokers/internal/testutils/golden" + "github.com/canonical/authd/log" "github.com/golang-jwt/jwt/v5" "github.com/stretchr/testify/require" - "github.com/ubuntu/authd/log" "golang.org/x/oauth2" ) diff --git a/authd-oidc-brokers/internal/testutils/provider.go b/authd-oidc-brokers/internal/testutils/provider.go index 31c8a5558b..3c809e898e 100644 --- a/authd-oidc-brokers/internal/testutils/provider.go +++ b/authd-oidc-brokers/internal/testutils/provider.go @@ -20,10 +20,10 @@ import ( "github.com/canonical/authd/authd-oidc-brokers/internal/consts" "github.com/canonical/authd/authd-oidc-brokers/internal/providers/genericprovider" "github.com/canonical/authd/authd-oidc-brokers/internal/providers/info" + "github.com/canonical/authd/log" "github.com/coreos/go-oidc/v3/oidc" "github.com/go-jose/go-jose/v4" "github.com/golang-jwt/jwt/v5" - "github.com/ubuntu/authd/log" "golang.org/x/oauth2" ) diff --git a/snap/variants/google/snapcraft.yaml b/snap/variants/google/snapcraft.yaml index 8ab2247580..357a202bb9 100644 --- a/snap/variants/google/snapcraft.yaml +++ b/snap/variants/google/snapcraft.yaml @@ -17,11 +17,9 @@ description: | Explore the official documentation for installation and configuration steps, or visit the GitHub repository to contribute or provide feedback. icon: snap/variants/google/icon.svg -website: - - https://github.com/ubuntu/authd-oidc-brokers - - https://github.com/ubuntu/authd -issues: https://github.com/ubuntu/authd/issues -source-code: https://github.com/ubuntu/authd-oidc-brokers/tree/google +website: https://documentation.ubuntu.com/authd +issues: https://github.com/canonical/authd/issues +source-code: https://github.com/canonical/authd/tree/main/authd-oidc-brokers adopt-info: version grade: stable base: core24 @@ -49,7 +47,9 @@ slots: parts: broker: - source: authd-oidc-brokers + # TODO: When the replace directive in authd-oidc-brokers/go.mod is removed, + # change source back to 'authd-oidc-brokers' and remove the 'cd' command below. + source: . source-type: local plugin: nil build-snaps: @@ -58,10 +58,13 @@ parts: - GOFLAGS: "-tags=release" - GOBIN: ${CRAFT_PART_INSTALL}/bin override-build: | + # TODO: Remove this 'cd' command when the replace directive in + # authd-oidc-brokers/go.mod is removed. + cd authd-oidc-brokers go mod download all go mod vendor VERSION=$(craftctl get version) - export GOFLAGS="-ldflags=-X=github.com/ubuntu/authd-oidc-brokers/internal/consts.Version=${VERSION}" + export GOFLAGS="-ldflags=-X=github.com/canonical/authd/authd-oidc-brokers/internal/consts.Version=${VERSION}" go build -tags=withgoogle -o ${GOBIN}/authd-google ./cmd/authd-oidc after: - version diff --git a/snap/variants/msentraid/snapcraft.yaml b/snap/variants/msentraid/snapcraft.yaml index d4e957f677..089d77812f 100644 --- a/snap/variants/msentraid/snapcraft.yaml +++ b/snap/variants/msentraid/snapcraft.yaml @@ -17,11 +17,9 @@ description: | Explore the official documentation for installation and configuration steps, or visit the GitHub repository to contribute or provide feedback. icon: snap/variants/msentraid/icon.svg -website: - - https://github.com/ubuntu/authd-oidc-brokers - - https://github.com/ubuntu/authd -issues: https://github.com/ubuntu/authd/issues -source-code: https://github.com/ubuntu/authd-oidc-brokers/tree/msentraid +website: https://documentation.ubuntu.com/authd +issues: https://github.com/canonical/authd/issues +source-code: https://github.com/canonical/authd/tree/main/authd-oidc-brokers adopt-info: version grade: stable base: core24 @@ -68,7 +66,9 @@ parts: - -include/** - -lib/**.so broker: - source: authd-oidc-brokers + # TODO: When the replace directive in authd-oidc-brokers/go.mod is removed, + # change source back to 'authd-oidc-brokers' and remove the 'cd' command below. + source: . source-type: local plugin: nil build-snaps: @@ -83,10 +83,13 @@ parts: - CGO_LDFLAGS: -L${CRAFT_STAGE}/lib -lhimmelblau - GOBIN: ${CRAFT_PART_INSTALL}/bin override-build: | + # TODO: Remove this 'cd' command when the replace directive in + # authd-oidc-brokers/go.mod is removed. + cd authd-oidc-brokers go mod download all go mod vendor VERSION=$(craftctl get version) - export GOFLAGS="-ldflags=-X=github.com/ubuntu/authd-oidc-brokers/internal/consts.Version=${VERSION}" + export GOFLAGS="-ldflags=-X=github.com/canonical/authd/authd-oidc-brokers/internal/consts.Version=${VERSION}" go build -tags=withmsentraid -o ${GOBIN}/authd-msentraid ./cmd/authd-oidc config: source: authd-oidc-brokers/conf/ diff --git a/snap/variants/oidc/snapcraft.yaml b/snap/variants/oidc/snapcraft.yaml index 9e554f6de5..fa6a4936f8 100644 --- a/snap/variants/oidc/snapcraft.yaml +++ b/snap/variants/oidc/snapcraft.yaml @@ -19,7 +19,7 @@ description: | icon: snap/variants/oidc/icon.svg website: https://documentation.ubuntu.com/authd issues: https://github.com/canonical/authd/issues -source-code: https://github.com/canonical/authd +source-code: https://github.com/canonical/authd/tree/main/authd-oidc-brokers adopt-info: version grade: stable base: core24 @@ -47,7 +47,9 @@ slots: parts: broker: - source: authd-oidc-brokers + # TODO: When the replace directive in authd-oidc-brokers/go.mod is removed, + # change source back to 'authd-oidc-brokers' and remove the 'cd' command below. + source: . source-type: local plugin: nil build-snaps: @@ -56,6 +58,9 @@ parts: - GOFLAGS: "-tags=release" - GOBIN: ${CRAFT_PART_INSTALL}/bin override-build: | + # TODO: Remove this 'cd' command when the replace directive in + # authd-oidc-brokers/go.mod is removed. + cd authd-oidc-brokers go mod download all go mod vendor VERSION=$(craftctl get version) From 446f564396d37d80e5133dcb04d933d1adc1663a Mon Sep 17 00:00:00 2001 From: Noor Eldeen Mansour Date: Thu, 19 Mar 2026 12:42:49 +0200 Subject: [PATCH 2/2] snap: Fix release tag overwrite in broker builds The `export GOFLAGS="-ldflags=..."` in override-build was overwriting the `GOFLAGS: "-tags=release"` set in build-environment, causing the release tag to be silently dropped during compilation. This tag controls whether the build-time source directory is embedded as RPATH in the binary for msentraid broker Moved `-tags=release` directly to each variant's go build command line and passed `-ldflags` as a flag instead GOFLAGS export. This ensures the tag is always applied and makes all flags explicit and visible. --- snap/variants/google/snapcraft.yaml | 4 +--- snap/variants/msentraid/snapcraft.yaml | 4 +--- snap/variants/oidc/snapcraft.yaml | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/snap/variants/google/snapcraft.yaml b/snap/variants/google/snapcraft.yaml index 357a202bb9..00facfa1da 100644 --- a/snap/variants/google/snapcraft.yaml +++ b/snap/variants/google/snapcraft.yaml @@ -55,7 +55,6 @@ parts: build-snaps: - go build-environment: - - GOFLAGS: "-tags=release" - GOBIN: ${CRAFT_PART_INSTALL}/bin override-build: | # TODO: Remove this 'cd' command when the replace directive in @@ -64,8 +63,7 @@ parts: go mod download all go mod vendor VERSION=$(craftctl get version) - export GOFLAGS="-ldflags=-X=github.com/canonical/authd/authd-oidc-brokers/internal/consts.Version=${VERSION}" - go build -tags=withgoogle -o ${GOBIN}/authd-google ./cmd/authd-oidc + go build -tags=withgoogle,release -ldflags "-X=github.com/canonical/authd/authd-oidc-brokers/internal/consts.Version=${VERSION}" -o ${GOBIN}/authd-google ./cmd/authd-oidc after: - version config: diff --git a/snap/variants/msentraid/snapcraft.yaml b/snap/variants/msentraid/snapcraft.yaml index 089d77812f..b9f9658f6a 100644 --- a/snap/variants/msentraid/snapcraft.yaml +++ b/snap/variants/msentraid/snapcraft.yaml @@ -77,7 +77,6 @@ parts: - libhimmelblau - version build-environment: - - GOFLAGS: "-tags=release" # Add libhimmelblau to the CFLAGS and LDFLAGS so that it can be found by the Go linker. - CGO_CFLAGS: -I${CRAFT_STAGE}/include - CGO_LDFLAGS: -L${CRAFT_STAGE}/lib -lhimmelblau @@ -89,8 +88,7 @@ parts: go mod download all go mod vendor VERSION=$(craftctl get version) - export GOFLAGS="-ldflags=-X=github.com/canonical/authd/authd-oidc-brokers/internal/consts.Version=${VERSION}" - go build -tags=withmsentraid -o ${GOBIN}/authd-msentraid ./cmd/authd-oidc + go build -tags=withmsentraid,release -ldflags "-X=github.com/canonical/authd/authd-oidc-brokers/internal/consts.Version=${VERSION}" -o ${GOBIN}/authd-msentraid ./cmd/authd-oidc config: source: authd-oidc-brokers/conf/ source-type: local diff --git a/snap/variants/oidc/snapcraft.yaml b/snap/variants/oidc/snapcraft.yaml index fa6a4936f8..69f7b67610 100644 --- a/snap/variants/oidc/snapcraft.yaml +++ b/snap/variants/oidc/snapcraft.yaml @@ -55,7 +55,6 @@ parts: build-snaps: - go build-environment: - - GOFLAGS: "-tags=release" - GOBIN: ${CRAFT_PART_INSTALL}/bin override-build: | # TODO: Remove this 'cd' command when the replace directive in @@ -64,8 +63,7 @@ parts: go mod download all go mod vendor VERSION=$(craftctl get version) - export GOFLAGS="-ldflags=-X=github.com/canonical/authd/authd-oidc-brokers/internal/consts.Version=${VERSION}" - go build -o ${GOBIN}/authd-oidc ./cmd/authd-oidc + go build -tags=release -ldflags "-X=github.com/canonical/authd/authd-oidc-brokers/internal/consts.Version=${VERSION}" -o ${GOBIN}/authd-oidc ./cmd/authd-oidc after: - version config: