Use the API to fetch the remote default branch
A simpler and quicker way to fetch the default branch of a remote Git URL.
- Based on #1035 (comment 602953289).
- A more solid solution of !1885 (closed).
- Fixes #1037 (closed).
Test locally
- Check that building the
latestimage fails:docker build --build-arg NANOC_ENV=production --build-arg=CI_COMMIT_REF_NAME=main -t docs:latest -f Dockerfile.main . - Build the
baseimage that includesjq!1886 (merged)docker build -t registry.gitlab.com/gitlab-org/gitlab-docs:base -f dockerfiles/Dockerfile.gitlab-docs-base . - Build the
bootstrapimage:docker build -t registry.gitlab.com/gitlab-org/gitlab-docs:bootstrap -f dockerfiles/Dockerfile.bootstrap . - Build the
latestimage and see it succeeding:docker build --build-arg NANOC_ENV=production --build-arg=CI_COMMIT_REF_NAME=main -t docs:latest -f Dockerfile.main .
After this is merged
-
Find the latest scheduled pipeline in https://gitlab.com/gitlab-org/gitlab-docs/-/pipelines and run the image:docs-latestjob manually. -
Verify that the issue #1035 (closed) is fixed and close it.
Edited by Achilleas Pipinellis