Skip to content

Commit 9a82b01

Browse files
committed
refactor: streamline plugin build process in Docker workflow
- Removed outdated dependency management steps for plugins, simplifying the build process. - Added `go mod download`, `go mod verify`, and `go mod tidy` commands for each plugin to ensure up-to-date dependencies and improve build reliability. - Enhanced clarity and maintainability of the Docker workflow for plugin builds.
1 parent 5b854cf commit 9a82b01

File tree

1 file changed

+13
-32
lines changed

1 file changed

+13
-32
lines changed

.github/workflows/docker-deploy.yml

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -82,38 +82,7 @@ jobs:
8282
run: |
8383
# Prepare plugin dependencies
8484
make prepare-plugins-build
85-
86-
# Fix plugin dependency versions to match main module
87-
for plugin_dir in pkg/plugins/glauth-*; do
88-
if [ -d "$plugin_dir" ] && [ -f "$plugin_dir/go.mod" ]; then
89-
echo "Updating dependencies for $plugin_dir"
90-
cd "$plugin_dir"
91-
92-
# Clear the module cache to avoid conflicts
93-
go clean -modcache || true
94-
95-
# Remove all problematic requirements and replace with compatible versions
96-
go mod edit -droprequire github.com/glauth/ldap || true
97-
go mod edit -droprequire github.com/glauth/glauth/v2 || true
98-
go mod edit -droprequire github.com/nnstd/glauth/v2 || true
99-
100-
# Add replace directives to use local main module
101-
go mod edit -replace github.com/nnstd/glauth/v2=../../..
102-
go mod edit -replace github.com/glauth/glauth/v2=../../..
103-
go mod edit -replace github.com/glauth/ldap@v0.0.0-20210720162743-7f8d1e44eeba=github.com/glauth/ldap@v0.0.0-20240419171521-1f14f5c1b4ad
104-
105-
# Update to compatible versions from main module
106-
go get github.com/glauth/ldap@v0.0.0-20240419171521-1f14f5c1b4ad
107-
go mod tidy
108-
109-
# Show the updated go.mod for debugging
110-
echo "Updated go.mod for $plugin_dir:"
111-
cat go.mod
112-
113-
cd ../../..
114-
fi
115-
done
116-
85+
11786
# Ensure all dependencies are up to date after plugin preparation
11887
go mod download
11988
go mod verify
@@ -125,6 +94,9 @@ jobs:
12594
if [ -d "pkg/plugins/glauth-sqlite" ]; then
12695
echo "Building SQLite plugin..."
12796
cd pkg/plugins/glauth-sqlite
97+
go mod download
98+
go mod verify
99+
go mod tidy
128100
xgo -image techknowlogick/xgo:latest -v -ldflags="-s -w" -go $GO_RELEASE_V -out sqlite -dest ../../../bin \
129101
-buildmode=plugin -targets="linux/amd64,linux/386,linux/arm64,linux/arm-7,darwin/amd64,darwin/arm64" \
130102
-env="GO111MODULE=on,GOPROXY=https://proxy.golang.org,direct" .
@@ -135,6 +107,9 @@ jobs:
135107
if [ -d "pkg/plugins/glauth-mysql" ]; then
136108
echo "Building MySQL plugin..."
137109
cd pkg/plugins/glauth-mysql
110+
go mod download
111+
go mod verify
112+
go mod tidy
138113
xgo -image techknowlogick/xgo:latest -v -ldflags="-s -w" -go $GO_RELEASE_V -out mysql -dest ../../../bin \
139114
-buildmode=plugin -targets="linux/amd64,linux/386,linux/arm64,linux/arm-7,darwin/amd64,darwin/arm64" \
140115
-env="GO111MODULE=on,GOPROXY=https://proxy.golang.org,direct" .
@@ -145,6 +120,9 @@ jobs:
145120
if [ -d "pkg/plugins/glauth-postgres" ]; then
146121
echo "Building PostgreSQL plugin..."
147122
cd pkg/plugins/glauth-postgres
123+
go mod download
124+
go mod verify
125+
go mod tidy
148126
xgo -image techknowlogick/xgo:latest -v -ldflags="-s -w" -go $GO_RELEASE_V -out postgres -dest ../../../bin \
149127
-buildmode=plugin -targets="linux/amd64,linux/386,linux/arm64,linux/arm-7,darwin/amd64,darwin/arm64" \
150128
-env="GO111MODULE=on,GOPROXY=https://proxy.golang.org,direct" .
@@ -155,6 +133,9 @@ jobs:
155133
if [ -d "pkg/plugins/glauth-pam" ]; then
156134
echo "Building PAM plugin..."
157135
cd pkg/plugins/glauth-pam
136+
go mod download
137+
go mod verify
138+
go mod tidy
158139
xgo -image techknowlogick/xgo:latest -v -ldflags="-s -w" -go $GO_RELEASE_V -out pam -dest ../../../bin \
159140
-buildmode=plugin -targets="linux/amd64,linux/386,linux/arm64,linux/arm-7" \
160141
-deps 'https://github.com/linux-pam/linux-pam/releases/download/v1.5.2/Linux-PAM-1.5.2.tar.xz' \

0 commit comments

Comments
 (0)