Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah German <sgerman@gitlab.com>2022-09-27 21:40:40 +0300
committerSarah German <sgerman@gitlab.com>2022-09-27 21:40:40 +0300
commitd8eb7b079deb940f187feaea05db645113a86bc1 (patch)
tree29195eb010de1ee07633f3e6f8c4a33a1fc2ce69
parentb751a618484f48eefd1201d9aa5bf6248a8c97a2 (diff)
parentcbb96ce72e2ef4b8220c621244e742f97fc90cc0 (diff)
Merge branch 'build-args' into 'main'
Replace `sed` with `--build-arg` for Dockerfile See merge request https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/3098 Merged-by: Sarah German <sgerman@gitlab.com> Approved-by: Marcel Amirault <mamirault@gitlab.com> Approved-by: Sarah German <sgerman@gitlab.com> Co-authored-by: Anatoli Babenia <anatoli@rainforce.org>
-rw-r--r--.gitlab-ci.yml8
-rw-r--r--.gitlab/ci/docker-images.gitlab-ci.yml12
-rw-r--r--dockerfiles/builder.onbuild.Dockerfile4
-rw-r--r--dockerfiles/single.Dockerfile13
-rw-r--r--lib/tasks/release.rake17
5 files changed, 12 insertions, 42 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 15ecad53..4a6ea83a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,15 +18,7 @@ stages:
- deploy
- post-deploy
-#
-# Pick the remote branch, by default master (see the Rakefile for more info)
-#
variables:
- BRANCH_EE: 'master'
- BRANCH_OMNIBUS: 'master'
- BRANCH_RUNNER: 'main'
- BRANCH_CHARTS: 'master'
- BRANCH_OPERATOR: 'master'
BUNDLE_PATH__SYSTEM: 'false'
GIT_DEPTH: '20'
ALPINE_VERSION: '3.16'
diff --git a/.gitlab/ci/docker-images.gitlab-ci.yml b/.gitlab/ci/docker-images.gitlab-ci.yml
index 9263b7d5..68066286 100644
--- a/.gitlab/ci/docker-images.gitlab-ci.yml
+++ b/.gitlab/ci/docker-images.gitlab-ci.yml
@@ -232,22 +232,14 @@ test:image:docs-single:
stage: test
variables:
DOCKERFILE: dockerfiles/single.Dockerfile
- MAJOR_VERSION_GITLAB: '15'
- MINOR_VERSION_GITLAB: '0'
- MAJOR_VERSION_CHARTS: '6'
- MINOR_VERSION_CHARTS: '0'
+ GITLAB_VERSION: '15.3'
needs: []
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- $DOCKERFILE
script:
- # Update template with version numbers
- - sed -i "s/X\.Y/${MAJOR_VERSION_GITLAB}\.${MINOR_VERSION_GITLAB}/" $DOCKERFILE
- - sed -i "s/X-Y/${MAJOR_VERSION_GITLAB}-${MINOR_VERSION_GITLAB}/" $DOCKERFILE
- - sed -i "s/W-Z/${MAJOR_VERSION_CHARTS}-${MINOR_VERSION_CHARTS}/" $DOCKERFILE
- # Build the image
- - docker build --file $DOCKERFILE .
+ - docker build --file $DOCKERFILE --build-arg VER=${GITLAB_VERSION} .
#
# Build master containing the online archives and latest docs (on schedules)
diff --git a/dockerfiles/builder.onbuild.Dockerfile b/dockerfiles/builder.onbuild.Dockerfile
index 94faeb84..400b9fd6 100644
--- a/dockerfiles/builder.onbuild.Dockerfile
+++ b/dockerfiles/builder.onbuild.Dockerfile
@@ -5,10 +5,6 @@ FROM registry.gitlab.com/gitlab-org/gitlab-docs:bootstrap
ONBUILD ARG VER
ONBUILD ARG NANOC_ENV
ONBUILD ARG CI_COMMIT_REF_NAME
-ONBUILD ARG BRANCH_EE
-ONBUILD ARG BRANCH_OMNIBUS
-ONBUILD ARG BRANCH_RUNNER
-ONBUILD ARG BRANCH_CHARTS
# Build the docs from this branch
ONBUILD COPY . /source/
diff --git a/dockerfiles/single.Dockerfile b/dockerfiles/single.Dockerfile
index 6aa88c17..d32e8537 100644
--- a/dockerfiles/single.Dockerfile
+++ b/dockerfiles/single.Dockerfile
@@ -24,15 +24,10 @@ FROM ruby:2.7.6-alpine3.16 AS builder
# Copy minifier binary from the minifier stage
COPY --from=minifier /minify /usr/local/bin/minify
-# Set to the version for this archive (must match the branch name)
-ENV VER=X.Y
-ENV CI_COMMIT_REF_NAME=X.Y
-
-# Replace the versions to match the stable branches of the upstream projects
-ENV BRANCH_EE=X-Y-stable-ee
-ENV BRANCH_OMNIBUS=X-Y-stable
-ENV BRANCH_RUNNER=X-Y-stable
-ENV BRANCH_CHARTS=W-Z-stable
+# Set versions as build args to fetch corresponding branches
+ARG VER
+
+ENV CI_COMMIT_REF_NAME=$VER
# Set NANOC_ENV to production
ENV NANOC_ENV=production
diff --git a/lib/tasks/release.rake b/lib/tasks/release.rake
index 65aa0b4d..fb3fea4d 100644
--- a/lib/tasks/release.rake
+++ b/lib/tasks/release.rake
@@ -33,7 +33,7 @@ namespace :release do
# Create branch
`git checkout -b #{version}`
- # Replace the branches variables in Dockerfile.X.Y
+ # Set version variable in X.Y.Dockerfile
dockerfile = "#{version}.Dockerfile"
if File.exist?(dockerfile)
@@ -41,28 +41,23 @@ namespace :release do
end
content = File.read('dockerfiles/single.Dockerfile')
- content.gsub!('X.Y', version)
- content.gsub!('X-Y', version.tr('.', '-'))
- content.gsub!('W-Z', task_helpers.chart_version(version).tr('.', '-'))
+ content.gsub!('ARG VER', "ARG VER=#{version}")
File.open(dockerfile, 'w') do |post|
post.puts content
end
- # Replace the branches variables in .gitlab-ci.yml
- ci_yaml = ".gitlab-ci.yml"
+ # Update GitLab version variable in .gitlab/ci/docker-images.gitlab-ci.yml
+ ci_yaml = ".gitlab/ci/docker-images.gitlab-ci.yml"
ci_yaml_content = File.read(ci_yaml)
- ci_yaml_content.gsub!("BRANCH_EE: 'master'", "BRANCH_EE: '#{version.tr('.', '-')}-stable-ee'")
- ci_yaml_content.gsub!("BRANCH_OMNIBUS: 'master'", "BRANCH_OMNIBUS: '#{version.tr('.', '-')}-stable'")
- ci_yaml_content.gsub!("BRANCH_RUNNER: 'main'", "BRANCH_RUNNER: '#{version.tr('.', '-')}-stable'")
- ci_yaml_content.gsub!("BRANCH_CHARTS: 'master'", "BRANCH_CHARTS: '#{task_helpers.chart_version(version).tr('.', '-')}-stable'")
+ ci_yaml_content.gsub!(/GITLAB_VERSION: \S+/, "GITLAB_VERSION: '#{version}'")
File.open(ci_yaml, 'w') do |post|
post.puts ci_yaml_content
end
# Add and commit
- `git add .gitlab-ci.yml #{version}.Dockerfile`
+ `git add .gitlab/ci/docker-images.gitlab-ci.yml #{version}.Dockerfile`
`git commit -m 'Release cut #{version}'`
puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: Created new Dockerfile:#{TaskHelpers::COLOR_CODE_RESET} #{dockerfile}."