Skip to content

Commit 363ea98

Browse files
Shocktroopertimofurrer
authored andcommitted
Adding registry enablement fixes
1 parent f283205 commit 363ea98

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ website/build
3030
website/node_modules
3131
website/vendor
3232
/tmp
33+
certs/gitlab-registry.crt
34+
certs/gitlab-registry.key

GNUmakefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,20 @@ SERVICE ?= gitlab-ce
6565
GITLAB_TOKEN ?= ACCTEST1234567890123
6666
GITLAB_BASE_URL ?= http://127.0.0.1:8080/api/v4
6767

68-
testacc-up: ## Launch a GitLab instance.
68+
testacc-up: | certs ## Launch a GitLab instance.
6969
docker-compose up -d $(SERVICE)
7070
./scripts/await-healthy.sh
7171

7272
testacc-down: ## Teardown a GitLab instance.
73-
docker-compose down
73+
docker-compose down --volumes
7474

7575
testacc: ## Run acceptance tests against a GitLab instance.
7676
TF_ACC=1 GITLAB_TOKEN=$(GITLAB_TOKEN) GITLAB_BASE_URL=$(GITLAB_BASE_URL) go test -v $(PROVIDER_SRC_DIR) $(TESTARGS) -timeout 40m
7777

78+
certs: ## Generate certs for the GitLab container registry
79+
mkdir -p certs
80+
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout certs/gitlab-registry.key -out certs/gitlab-registry.crt -subj "/CN=gitlab-registry.com" -addext "subjectAltName=DNS:IP:127.0.0.1"
81+
7882
# TOOLS
7983
# Tool dependencies are installed into a project-local /bin folder.
8084

docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ services:
1717
- logs-ce:/var/log/gitlab
1818
- data-ce:/var/opt/gitlab
1919
- ${PWD}/scripts/healthcheck-and-setup.sh:/healthcheck-and-setup.sh:Z
20+
- ${PWD}/scripts/gitlab.rb:/etc/gitlab/gitlab.rb:ro
21+
- ${PWD}/certs:/etc/gitlab/ssl:ro
2022
healthcheck:
2123
test: /healthcheck-and-setup.sh
2224
interval: 10s
@@ -38,6 +40,8 @@ services:
3840
- data-ee:/var/opt/gitlab
3941
- ${PWD}/scripts/healthcheck-and-setup.sh:/healthcheck-and-setup.sh:Z
4042
- ${PWD}/Gitlab-license.txt:/Gitlab-license.txt:Z
43+
- ${PWD}/scripts/gitlab.rb:/etc/gitlab/gitlab.rb:ro
44+
- ${PWD}/certs:/etc/gitlab/ssl:ro
4145
healthcheck:
4246
test: /healthcheck-and-setup.sh
4347
interval: 10s

scripts/gitlab.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
registry_external_url 'http://127.0.0.1:5050'
2+
registry['enable'] = true
3+
registry_nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab-registry.pem"
4+
registry_nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab-registry.key"

scripts/healthcheck-and-setup.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ test -f $done || {
2828
printf 'terraform_token.save!;'
2929
) | gitlab-rails console
3030

31-
echo "Enabling the container registry for the instance so that Personal Access Tokens can be created with the read_registry and write_registry scopes"
32-
(
33-
printf 'Gitlab.config.registry["enabled"] = true'
34-
) | gitlab-rails console
35-
3631
# 2020-09-07: Currently Gitlab (version 13.3.6 ) doesn't allow in admin API
3732
# ability to set a group as instance level templates.
3833
# To test resource_gitlab_project_test template features we add

0 commit comments

Comments
 (0)