From 50bad158454f4ee5f592b77fb83778065329508b Mon Sep 17 00:00:00 2001 From: sue445 Date: Tue, 20 Jul 2021 18:20:33 +0900 Subject: [PATCH 1/2] Resolved. GitLab Pages doesn't work since GitLab v14.0 ref. #2375 As I can see from the error message below, it looks like both `api-secret-key` and `gitlab-server` (or `internal-gitlab-server` ) are required since GitLab v14.0 ``` time="2021-06-28T02:28:34Z" level=fatal msg="could not create domains config source" error="GitLab API URL or API secret has not been provided" ``` https://gitlab.com/gitlab-org/gitlab-pages/-/blob/v1.41.0/internal/source/gitlab/client/client.go#L50-52 --- assets/runtime/config/gitlab-pages/config | 2 ++ assets/runtime/functions | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/assets/runtime/config/gitlab-pages/config b/assets/runtime/config/gitlab-pages/config index 8b0edb60..f98fe4d1 100644 --- a/assets/runtime/config/gitlab-pages/config +++ b/assets/runtime/config/gitlab-pages/config @@ -4,3 +4,5 @@ auth-redirect-uri={{GITLAB_PAGES_ACCESS_REDIRECT_URI}} auth-secret={{GITLAB_PAGES_ACCESS_SECRET}} gitlab-server={{GITLAB_PAGES_ACCESS_CONTROL_SERVER}} artifacts-server={{GITLAB_PAGES_ARTIFACTS_SERVER_URL}} +internal-gitlab-server=http://localhost:8181 +api-secret-key=/home/git/gitlab/.gitlab_pages_secret diff --git a/assets/runtime/functions b/assets/runtime/functions index c0561674..dc82cb43 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -752,6 +752,12 @@ gitlab_configure_secrets() { exec_as_git openssl rand -base64 -out "${workhorse_secret}" 32 chmod 600 "${workhorse_secret}" fi + + local pages_secret="${GITLAB_INSTALL_DIR}/.gitlab_pages_secret" + if [[ ! -f "${pages_secret}" ]]; then + exec_as_git openssl rand -base64 -out "${pages_secret}" 32 + chmod 600 "${pages_secret}" + fi } gitlab_configure_sidekiq() { From 73dae28e31167ff16539f31959a7a7fe9cd439d5 Mon Sep 17 00:00:00 2001 From: sue445 Date: Wed, 21 Jul 2021 09:38:37 +0900 Subject: [PATCH 2/2] Pass {{GITLAB_INSTALL_DIR}} to gitlab-pages/config --- assets/runtime/config/gitlab-pages/config | 2 +- assets/runtime/functions | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/runtime/config/gitlab-pages/config b/assets/runtime/config/gitlab-pages/config index f98fe4d1..40978609 100644 --- a/assets/runtime/config/gitlab-pages/config +++ b/assets/runtime/config/gitlab-pages/config @@ -5,4 +5,4 @@ auth-secret={{GITLAB_PAGES_ACCESS_SECRET}} gitlab-server={{GITLAB_PAGES_ACCESS_CONTROL_SERVER}} artifacts-server={{GITLAB_PAGES_ARTIFACTS_SERVER_URL}} internal-gitlab-server=http://localhost:8181 -api-secret-key=/home/git/gitlab/.gitlab_pages_secret +api-secret-key={{GITLAB_INSTALL_DIR}}/.gitlab_pages_secret diff --git a/assets/runtime/functions b/assets/runtime/functions index dc82cb43..cd5f501f 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -1792,7 +1792,8 @@ if [[ ${GITLAB_PAGES_ACCESS_CONTROL} == true ]]; then GITLAB_PAGES_ACCESS_CLIENT_SECRET \ GITLAB_PAGES_ACCESS_REDIRECT_URI \ GITLAB_PAGES_ACCESS_SECRET \ - GITLAB_PAGES_ACCESS_CONTROL_SERVER + GITLAB_PAGES_ACCESS_CONTROL_SERVER \ + GITLAB_INSTALL_DIR if [[ -n ${GITLAB_PAGES_ARTIFACTS_SERVER_URL} ]]; then update_template ${GITLAB_PAGES_CONFIG} GITLAB_PAGES_ARTIFACTS_SERVER_URL