@@ -9,6 +9,7 @@ services:
99 - gitea-data:/data:ro
1010 - forgejo-data:/forgejo-data:ro
1111 - gogs-data:/gogs-data:ro
12+ - gitlab-data:/gitlab-data:ro
1213 environment :
1314 - TESTS_GITHUB_PRIVATE_KEY
1415 - TESTS_GITHUB_APP_IDENTIFIER
@@ -17,6 +18,7 @@ services:
1718 - TESTS_GITEA_REQUEST_CATCHER_URL=http://request-catcher:5000
1819 - TESTS_FORGEJO_URL=http://forgejo:3000
1920 - TESTS_GOGS_URL=http://gogs:3000
21+ - TESTS_GITLAB_URL=http://gitlab:80
2022 depends_on :
2123 gitea :
2224 condition : service_healthy
@@ -30,6 +32,10 @@ services:
3032 condition : service_healthy
3133 gogs-bootstrap :
3234 condition : service_completed_successfully
35+ gitlab :
36+ condition : service_healthy
37+ gitlab-bootstrap :
38+ condition : service_completed_successfully
3339 request-catcher :
3440 condition : service_started
3541
@@ -172,7 +178,72 @@ services:
172178 echo $$TOKEN > /data/gogs/token.txt
173179 fi
174180
181+ gitlab :
182+ image : gitlab/gitlab-ce:18.10.1-ce.0
183+ environment :
184+ - GITLAB_ROOT_PASSWORD=${GITLAB_ROOT_PASSWORD:-;asiweml@562}
185+ - GITLAB_ROOT_EMAIL=${GITLAB_ROOT_EMAIL:-utopia@example.com}
186+ - GITLAB_OMNIBUS_CONFIG=gitlab_rails['initial_root_password'] = ENV['GITLAB_ROOT_PASSWORD']; gitlab_rails['gitlab_signup_enabled'] = false;
187+ volumes :
188+ - gitlab-data:/var/opt/gitlab
189+ ports :
190+ - " 3003:80"
191+ healthcheck :
192+ test : ["CMD", "curl", "-f", "http://localhost/-/health"]
193+ interval : 30s
194+ timeout : 10s
195+ retries : 20
196+ start_period : 300s
197+
198+ gitlab-bootstrap :
199+ image : alpine/curl:8.12.1
200+ volumes :
201+ - gitlab-data:/gitlab-data
202+ depends_on :
203+ gitlab :
204+ condition : service_healthy
205+ environment :
206+ - GITLAB_ROOT_PASSWORD=${GITLAB_ROOT_PASSWORD:-;asiweml@562}
207+ entrypoint : /bin/sh
208+ command :
209+ - -c
210+ - |
211+ if [ -f /gitlab-data/token.txt ]; then exit 0; fi
212+
213+ apk add --no-cache perl
214+
215+ echo "Waiting for GitLab to be ready..."
216+ sleep 10
217+
218+ # Use OAuth2 password grant to get access token
219+ OAUTH_RESPONSE=$$(curl -s -X POST http://gitlab:80/oauth/token \
220+ --data-urlencode "grant_type=password" \
221+ --data-urlencode "username=root" \
222+ --data-urlencode "password=$$GITLAB_ROOT_PASSWORD" \
223+ --data-urlencode "scope=api")
224+ echo "OAuth response: $$OAUTH_RESPONSE"
225+
226+ OAUTH_TOKEN=$$(echo "$$OAUTH_RESPONSE" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
227+ echo "OAuth token: $$OAUTH_TOKEN"
228+
229+ if [ -z "$$OAUTH_TOKEN" ]; then echo "Failed to get OAuth token"; exit 1; fi
230+
231+ # Create PAT using OAuth token
232+ PAT_RESPONSE=$$(curl -s -X POST http://gitlab:80/api/v4/users/1/personal_access_tokens \
233+ -H "Authorization: Bearer $$OAUTH_TOKEN" \
234+ -H "Content-Type: application/json" \
235+ -d '{"name":"bootstrap","scopes":["api","read_user","read_repository","write_repository"]}')
236+ echo "PAT response: $$PAT_RESPONSE"
237+
238+ TOKEN=$$(echo "$$PAT_RESPONSE" | grep -o '"token":"[^"]*"' | cut -d'"' -f4)
239+ echo "Token: $$TOKEN"
240+
241+ if [ -z "$$TOKEN" ]; then echo "Failed to get token"; exit 1; fi
242+ mkdir -p /gitlab-data
243+ echo $$TOKEN > /gitlab-data/token.txt
244+
175245volumes :
176246 gitea-data :
177247 forgejo-data :
178- gogs-data:
248+ gogs-data :
249+ gitlab-data:
0 commit comments