diff options
-rw-r--r-- | Gemfile | 3 | ||||
-rw-r--r-- | Gemfile.lock | 2 | ||||
-rw-r--r-- | Rakefile | 27 | ||||
-rw-r--r-- | dockerfiles/Dockerfile.single | 10 | ||||
-rw-r--r-- | dockerfiles/README.md | 20 |
5 files changed, 39 insertions, 23 deletions
@@ -18,6 +18,7 @@ group :nanoc do gem 'builder' end -group :test do +group :test, :development do gem 'scss_lint', require: false + gem 'highline' end diff --git a/Gemfile.lock b/Gemfile.lock index 91bc0fc2..53f1de62 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,6 +44,7 @@ GEM nanoc (>= 4.3.8, < 5.0) hamster (3.0.0) concurrent-ruby (~> 1.0) + highline (1.7.10) http_parser.rb (0.6.0) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) @@ -104,6 +105,7 @@ DEPENDENCIES adsf-live builder guard-nanoc + highline nanoc (~> 4.8) nokogiri (~> 1.7.0) rake (~> 12.0) @@ -62,3 +62,30 @@ task :pull_repos do end end end + +namespace :release do + desc 'Creates a single release archive' + task :single, :version do |t, args| + require "highline/import" + version = args.version.to_s + source_dir = File.expand_path('../', __FILE__) + + raise 'You need to specify a version, like 10.1' unless version =~ /\A\d+\.\d+\z/ + + dockerfile = "#{source_dir}/Dockerfile.#{version}" + + if File.exist?(dockerfile) + abort('rake aborted!') if ask("#{dockerfile} already exists. Do you want to overwrite?", %w[y n]) == 'n' + end + + puts "Created new Dockerfile: #{dockerfile}" + + content = File.read('dockerfiles/Dockerfile.single') + content.gsub!('X.Y', version) + content.gsub!('X-Y', version.tr('.', '-')) + + open(dockerfile, 'w') do |post| + post.puts content + end + end +end
\ No newline at end of file diff --git a/dockerfiles/Dockerfile.single b/dockerfiles/Dockerfile.single index d3aa144a..e2df882e 100644 --- a/dockerfiles/Dockerfile.single +++ b/dockerfiles/Dockerfile.single @@ -3,13 +3,13 @@ # # Set to the version for this archive (must match the branch name) -ARG VER=10.4 +ARG VER=X.Y # Replace the versions to march the stable branches of the upstream projects -ARG BRANCH_EE=10-4-stable-ee -ARG BRANCH_CE=10-4-stable -ARG BRANCH_OMNIBUS=10-4-stable -ARG BRANCH_RUNNER=10-4-stable +ARG BRANCH_EE=X-Y-stable-ee +ARG BRANCH_CE=X-Y-stable +ARG BRANCH_OMNIBUS=X-Y-stable +ARG BRANCH_RUNNER=X-Y-stable # This image comes from the Dockerfile.builder.onbuild file # https://gitlab.com/gitlab-com/gitlab-docs/blob/master/dockerfiles/Dockerfile.builder.onbuild diff --git a/dockerfiles/README.md b/dockerfiles/README.md index 7b81e945..f1961489 100644 --- a/dockerfiles/README.md +++ b/dockerfiles/README.md @@ -55,27 +55,13 @@ and update the `latest` and `archives` images to include the new version. git checkout -b 10.5 ``` -1. Copy `Dockerfile.single` to `Dockerfile.$version` in the root path: +1. Run the raketask to create the single version: ``` - cp dockerfiles/Dockerfile.single Dockerfile.10.5 + bundle exec rake "release:single[10.5]" ``` -1. Edit the Dockerfile and add the correct version as well as the remote branches: - - ``` - # The branch of the docs repo from step 1 - ARG VER=10.5 - - # Replace the versions to match the stable branches of the upstream projects - ARG BRANCH_EE=10-5-stable-ee - ARG BRANCH_CE=10-5-stable - ARG BRANCH_OMNIBUS=10-5-stable - ARG BRANCH_RUNNER=10-5-stable - - FROM registry.gitlab.com/gitlab-com/gitlab-docs:builder-onbuild AS builder - FROM registry.gitlab.com/gitlab-com/gitlab-docs:nginx-onbuild - ``` + A new `Dockerfile.10.5` should have been created. 1. Test locally by building the image and running it: |