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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-08 15:06:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-08 15:06:32 +0300
commit61f0c58946ebac453b55a657cd4be1ac50a01e11 (patch)
tree7b164c1cc9dc8ab1d100ca4fe90decf6d72e984b /lib/gitlab/ci
parentd23b2a0871f3ca507aafa949e0314625f1f0c6a7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci')
-rw-r--r--lib/gitlab/ci/config/entry/job.rb6
-rw-r--r--lib/gitlab/ci/config/entry/need.rb44
-rw-r--r--lib/gitlab/ci/config/entry/needs.rb55
-rw-r--r--lib/gitlab/ci/config/normalizer.rb20
-rw-r--r--lib/gitlab/ci/templates/Android-Fastlane.gitlab-ci.yml5
-rw-r--r--lib/gitlab/ci/templates/Docker.gitlab-ci.yml6
-rw-r--r--lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml27
-rw-r--r--lib/gitlab/ci/templates/Julia.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Maven.gitlab-ci.yml10
-rw-r--r--lib/gitlab/ci/templates/Mono.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/OpenShift.gitlab-ci.yml12
-rw-r--r--lib/gitlab/ci/templates/Packer.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/Brunch.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/Doxygen.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/Gatsby.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/HTML.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/Harp.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/Hexo.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/Hugo.gitlab-ci.yml6
-rw-r--r--lib/gitlab/ci/templates/Pages/Hyde.gitlab-ci.yml6
-rw-r--r--lib/gitlab/ci/templates/Pages/Jekyll.gitlab-ci.yml6
-rw-r--r--lib/gitlab/ci/templates/Pages/Jigsaw.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/Lektor.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/Metalsmith.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/Middleman.gitlab-ci.yml6
-rw-r--r--lib/gitlab/ci/templates/Pages/Nanoc.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/Octopress.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Pages/SwaggerUI.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Python.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Swift.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/templates/Terraform.gitlab-ci.yml3
-rw-r--r--lib/gitlab/ci/yaml_processor.rb16
32 files changed, 214 insertions, 65 deletions
diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb
index 1298e2d3462..2d5981a4255 100644
--- a/lib/gitlab/ci/config/entry/job.rb
+++ b/lib/gitlab/ci/config/entry/job.rb
@@ -50,7 +50,6 @@ module Gitlab
validates :timeout, duration: { limit: ChronicDuration.output(Project::MAX_BUILD_TIMEOUT) }
validates :dependencies, array_of_strings: true
- validates :needs, array_of_strings: true
validates :extends, array_of_strings_or_string: true
validates :rules, array_of_hashes: true
end
@@ -114,6 +113,11 @@ module Gitlab
description: 'List of evaluable Rules to determine job inclusion.',
inherit: false
+ entry :needs, Entry::Needs,
+ description: 'Needs configuration for this job.',
+ metadata: { allowed_needs: %i[job] },
+ inherit: false
+
entry :variables, Entry::Variables,
description: 'Environment variables available for this job.',
inherit: false
diff --git a/lib/gitlab/ci/config/entry/need.rb b/lib/gitlab/ci/config/entry/need.rb
new file mode 100644
index 00000000000..b6db546d8ff
--- /dev/null
+++ b/lib/gitlab/ci/config/entry/need.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ class Config
+ module Entry
+ class Need < ::Gitlab::Config::Entry::Simplifiable
+ strategy :Job, if: -> (config) { config.is_a?(String) }
+
+ class Job < ::Gitlab::Config::Entry::Node
+ include ::Gitlab::Config::Entry::Validatable
+
+ validations do
+ validates :config, presence: true
+ validates :config, type: String
+ end
+
+ def type
+ :job
+ end
+
+ def value
+ { name: @config }
+ end
+ end
+
+ class UnknownStrategy < ::Gitlab::Config::Entry::Node
+ def type
+ end
+
+ def value
+ end
+
+ def errors
+ ["#{location} has an unsupported type"]
+ end
+ end
+ end
+ end
+ end
+ end
+end
+
+::Gitlab::Ci::Config::Entry::Need.prepend_if_ee('::EE::Gitlab::Ci::Config::Entry::Need')
diff --git a/lib/gitlab/ci/config/entry/needs.rb b/lib/gitlab/ci/config/entry/needs.rb
new file mode 100644
index 00000000000..28452aaaa16
--- /dev/null
+++ b/lib/gitlab/ci/config/entry/needs.rb
@@ -0,0 +1,55 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ class Config
+ module Entry
+ ##
+ # Entry that represents a set of needs dependencies.
+ #
+ class Needs < ::Gitlab::Config::Entry::Node
+ include ::Gitlab::Config::Entry::Validatable
+
+ validations do
+ validates :config, presence: true
+
+ validate do
+ unless config.is_a?(Hash) || config.is_a?(Array)
+ errors.add(:config, 'can only be a Hash or an Array')
+ end
+ end
+
+ validate on: :composed do
+ extra_keys = value.keys - opt(:allowed_needs)
+ if extra_keys.any?
+ errors.add(:config, "uses invalid types: #{extra_keys.join(', ')}")
+ end
+ end
+ end
+
+ def compose!(deps = nil)
+ super(deps) do
+ [@config].flatten.each_with_index do |need, index|
+ @entries[index] = ::Gitlab::Config::Entry::Factory.new(Entry::Need)
+ .value(need)
+ .with(key: "need", parent: self, description: "need definition.") # rubocop:disable CodeReuse/ActiveRecord
+ .create!
+ end
+
+ @entries.each_value do |entry|
+ entry.compose!(deps)
+ end
+ end
+ end
+
+ def value
+ values = @entries.values.select(&:type)
+ values.group_by(&:type).transform_values do |values|
+ values.map(&:value)
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/config/normalizer.rb b/lib/gitlab/ci/config/normalizer.rb
index 09f9bf5f69f..e714ef225f5 100644
--- a/lib/gitlab/ci/config/normalizer.rb
+++ b/lib/gitlab/ci/config/normalizer.rb
@@ -18,8 +18,8 @@ module Gitlab
config[:dependencies] = expand_names(config[:dependencies])
end
- if config[:needs]
- config[:needs] = expand_names(config[:needs])
+ if job_needs = config.dig(:needs, :job)
+ config[:needs][:job] = expand_needs(job_needs)
end
config
@@ -36,6 +36,22 @@ module Gitlab
end
end
+ def expand_needs(job_needs)
+ return unless job_needs
+
+ job_needs.flat_map do |job_need|
+ job_need_name = job_need[:name].to_sym
+
+ if all_job_names = parallelized_jobs[job_need_name]
+ all_job_names.map do |job_name|
+ { name: job_name }
+ end
+ else
+ job_need
+ end
+ end
+ end
+
def parallelized_jobs
strong_memoize(:parallelized_jobs) do
@jobs_config.each_with_object({}) do |(job_name, config), hash|
diff --git a/lib/gitlab/ci/templates/Android-Fastlane.gitlab-ci.yml b/lib/gitlab/ci/templates/Android-Fastlane.gitlab-ci.yml
index be584814271..4ec3bb15230 100644
--- a/lib/gitlab/ci/templates/Android-Fastlane.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Android-Fastlane.gitlab-ci.yml
@@ -113,9 +113,10 @@ promoteBeta:
promoteProduction:
extends: .promote_job
stage: production
- # We only allow production promotion on `master` because
+ # We only allow production promotion on the default branch because
# it has its own production scoped secret variables
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
script:
- bundle exec fastlane promote_beta_to_production
diff --git a/lib/gitlab/ci/templates/Docker.gitlab-ci.yml b/lib/gitlab/ci/templates/Docker.gitlab-ci.yml
index 15cdbf63cb1..5160c05a251 100644
--- a/lib/gitlab/ci/templates/Docker.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Docker.gitlab-ci.yml
@@ -10,7 +10,8 @@ docker-build-master:
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
docker-build:
# Official docker image.
@@ -24,4 +25,5 @@ docker-build:
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
index a95714d5684..416aa19e666 100644
--- a/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml
@@ -24,9 +24,8 @@ review:
- tags
kubernetes: active
except:
- refs:
- - master
variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
- $REVIEW_DISABLED
stop_review:
@@ -48,9 +47,8 @@ stop_review:
- tags
kubernetes: active
except:
- refs:
- - master
variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
- $REVIEW_DISABLED
# Staging deploys are disabled by default since
@@ -73,10 +71,9 @@ staging:
name: staging
url: http://$CI_PROJECT_PATH_SLUG-staging.$KUBE_INGRESS_BASE_DOMAIN
only:
- refs:
- - master
kubernetes: active
variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
- $STAGING_ENABLED
# Canaries are disabled by default, but if you want them,
@@ -98,10 +95,9 @@ canary:
url: http://$CI_PROJECT_PATH_SLUG.$KUBE_INGRESS_BASE_DOMAIN
when: manual
only:
- refs:
- - master
kubernetes: active
variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
- $CANARY_ENABLED
.production: &production_template
@@ -126,9 +122,9 @@ canary:
production:
<<: *production_template
only:
- refs:
- - master
kubernetes: active
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
except:
variables:
- $STAGING_ENABLED
@@ -141,10 +137,9 @@ production_manual:
when: manual
allow_failure: false
only:
- refs:
- - master
kubernetes: active
variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
- $STAGING_ENABLED
- $CANARY_ENABLED
except:
@@ -152,7 +147,7 @@ production_manual:
- $INCREMENTAL_ROLLOUT_ENABLED
- $INCREMENTAL_ROLLOUT_MODE
-# This job implements incremental rollout on for every push to `master`.
+# This job implements incremental rollout for every push to the default branch.
.rollout: &rollout_template
extends: .auto-deploy
@@ -178,10 +173,9 @@ production_manual:
when: manual
# This selectors are backward compatible mode with $INCREMENTAL_ROLLOUT_ENABLED (before 11.4)
only:
- refs:
- - master
kubernetes: active
variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
- $INCREMENTAL_ROLLOUT_MODE == "manual"
- $INCREMENTAL_ROLLOUT_ENABLED
except:
@@ -193,10 +187,9 @@ production_manual:
when: delayed
start_in: 5 minutes
only:
- refs:
- - master
kubernetes: active
variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
- $INCREMENTAL_ROLLOUT_MODE == "timed"
timed rollout 10%:
diff --git a/lib/gitlab/ci/templates/Julia.gitlab-ci.yml b/lib/gitlab/ci/templates/Julia.gitlab-ci.yml
index 32d4e07d398..56785f2017d 100644
--- a/lib/gitlab/ci/templates/Julia.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Julia.gitlab-ci.yml
@@ -64,7 +64,8 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
# WARNING: This template is using the `julia` images from [Docker
# Hub][3]. One can use custom Julia images and/or the official ones found
diff --git a/lib/gitlab/ci/templates/Maven.gitlab-ci.yml b/lib/gitlab/ci/templates/Maven.gitlab-ci.yml
index 84bb0ff3b33..f6b69051bfa 100644
--- a/lib/gitlab/ci/templates/Maven.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Maven.gitlab-ci.yml
@@ -6,7 +6,7 @@
# This template will build and test your projects
# * Caches downloaded dependencies and plugins between invocation.
# * Verify but don't deploy merge requests.
-# * Deploy built artifacts from master branch only.
+# * Deploy built artifacts from the default branch only.
variables:
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
@@ -33,7 +33,8 @@ cache:
script:
- 'mvn $MAVEN_CLI_OPTS verify'
except:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
# Verify merge requests using JDK8
verify:jdk8:
@@ -42,7 +43,7 @@ verify:jdk8:
# To deploy packages from CI, create a ci_settings.xml file
# For deploying packages to GitLab's Maven Repository: See https://docs.gitlab.com/ee/user/project/packages/maven_repository.html#creating-maven-packages-with-gitlab-cicd for more details.
# Please note: The GitLab Maven Repository is currently only available in GitLab Premium / Ultimate.
-# For `master` branch run `mvn deploy` automatically.
+# For the default branch run `mvn deploy` automatically.
deploy:jdk8:
stage: deploy
script:
@@ -51,4 +52,5 @@ deploy:jdk8:
fi
- 'mvn $MAVEN_CLI_OPTS deploy -s ci_settings.xml'
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Mono.gitlab-ci.yml b/lib/gitlab/ci/templates/Mono.gitlab-ci.yml
index 10fb6be6c39..9192f233eac 100644
--- a/lib/gitlab/ci/templates/Mono.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Mono.gitlab-ci.yml
@@ -25,7 +25,8 @@ before_script:
release:
stage: deploy
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
artifacts:
paths:
- build/release/MyProject.exe
diff --git a/lib/gitlab/ci/templates/OpenShift.gitlab-ci.yml b/lib/gitlab/ci/templates/OpenShift.gitlab-ci.yml
index 65abee1f5eb..91de258eb7c 100644
--- a/lib/gitlab/ci/templates/OpenShift.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/OpenShift.gitlab-ci.yml
@@ -49,7 +49,8 @@ review:
only:
- branches
except:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
stop-review:
<<: *deploy
@@ -66,7 +67,8 @@ stop-review:
only:
- branches
except:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
staging:
<<: *deploy
@@ -78,7 +80,8 @@ staging:
name: staging
url: http://$CI_PROJECT_NAME-staging.$OPENSHIFT_DOMAIN
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
production:
<<: *deploy
@@ -91,4 +94,5 @@ production:
name: production
url: http://$CI_PROJECT_NAME.$OPENSHIFT_DOMAIN
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Packer.gitlab-ci.yml b/lib/gitlab/ci/templates/Packer.gitlab-ci.yml
index 0a3cf3dcf77..28255eb893c 100644
--- a/lib/gitlab/ci/templates/Packer.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Packer.gitlab-ci.yml
@@ -25,4 +25,5 @@ build:
- find . -maxdepth 1 -name '*.json' -print0 | xargs -t0n1 packer build
when: manual
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Brunch.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Brunch.gitlab-ci.yml
index d2dd3fbfb75..18778326029 100644
--- a/lib/gitlab/ci/templates/Pages/Brunch.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Brunch.gitlab-ci.yml
@@ -12,4 +12,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Doxygen.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Doxygen.gitlab-ci.yml
index ba422c08614..920b2c7dbd0 100644
--- a/lib/gitlab/ci/templates/Pages/Doxygen.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Doxygen.gitlab-ci.yml
@@ -10,4 +10,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Gatsby.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Gatsby.gitlab-ci.yml
index a683561a455..87f70abe0be 100644
--- a/lib/gitlab/ci/templates/Pages/Gatsby.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Gatsby.gitlab-ci.yml
@@ -14,4 +14,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/HTML.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/HTML.gitlab-ci.yml
index 92f25280c6e..8aee121a2e9 100644
--- a/lib/gitlab/ci/templates/Pages/HTML.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/HTML.gitlab-ci.yml
@@ -9,4 +9,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Harp.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Harp.gitlab-ci.yml
index 0e206423fa5..a784e89a6ca 100644
--- a/lib/gitlab/ci/templates/Pages/Harp.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Harp.gitlab-ci.yml
@@ -12,4 +12,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Hexo.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Hexo.gitlab-ci.yml
index d91a8d7421f..0750bb2cd97 100644
--- a/lib/gitlab/ci/templates/Pages/Hexo.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Hexo.gitlab-ci.yml
@@ -14,4 +14,5 @@ pages:
- node_modules
key: project
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Hugo.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Hugo.gitlab-ci.yml
index 9a3ecd1c34f..45b06c040bd 100644
--- a/lib/gitlab/ci/templates/Pages/Hugo.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Hugo.gitlab-ci.yml
@@ -8,10 +8,12 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
test:
script:
- hugo
except:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Hyde.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Hyde.gitlab-ci.yml
index 7a441a2f70f..6fadda88a30 100644
--- a/lib/gitlab/ci/templates/Pages/Hyde.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Hyde.gitlab-ci.yml
@@ -11,7 +11,8 @@ test:
- pip install hyde
- hyde gen
except:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
pages:
stage: deploy
@@ -22,4 +23,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Jekyll.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Jekyll.gitlab-ci.yml
index e7dacd3a1fc..ef0adfdfcf2 100644
--- a/lib/gitlab/ci/templates/Pages/Jekyll.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Jekyll.gitlab-ci.yml
@@ -17,7 +17,8 @@ test:
paths:
- test
except:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
pages:
stage: deploy
@@ -27,4 +28,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Jigsaw.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Jigsaw.gitlab-ci.yml
index 2d26b86a328..b53fcb3308a 100644
--- a/lib/gitlab/ci/templates/Pages/Jigsaw.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Jigsaw.gitlab-ci.yml
@@ -34,4 +34,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Lektor.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Lektor.gitlab-ci.yml
index 93ab8e0be0d..7fec535aedd 100644
--- a/lib/gitlab/ci/templates/Pages/Lektor.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Lektor.gitlab-ci.yml
@@ -9,4 +9,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Metalsmith.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Metalsmith.gitlab-ci.yml
index 6524405133a..7e661fc9858 100644
--- a/lib/gitlab/ci/templates/Pages/Metalsmith.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Metalsmith.gitlab-ci.yml
@@ -13,4 +13,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Middleman.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Middleman.gitlab-ci.yml
index 57ac323dfdf..cdd50485a81 100644
--- a/lib/gitlab/ci/templates/Pages/Middleman.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Middleman.gitlab-ci.yml
@@ -12,7 +12,8 @@ test:
- bundle install --path vendor
- bundle exec middleman build
except:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
pages:
script:
@@ -24,4 +25,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Nanoc.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Nanoc.gitlab-ci.yml
index 7f037b5f5cf..be1a2d0ff0a 100644
--- a/lib/gitlab/ci/templates/Pages/Nanoc.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Nanoc.gitlab-ci.yml
@@ -9,4 +9,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/Octopress.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/Octopress.gitlab-ci.yml
index 6d912a89bc1..616f9a6c99b 100644
--- a/lib/gitlab/ci/templates/Pages/Octopress.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/Octopress.gitlab-ci.yml
@@ -12,4 +12,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Pages/SwaggerUI.gitlab-ci.yml b/lib/gitlab/ci/templates/Pages/SwaggerUI.gitlab-ci.yml
index 8fd08ea7995..f3af9db3b42 100644
--- a/lib/gitlab/ci/templates/Pages/SwaggerUI.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Pages/SwaggerUI.gitlab-ci.yml
@@ -26,4 +26,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Python.gitlab-ci.yml b/lib/gitlab/ci/templates/Python.gitlab-ci.yml
index 00b8b94b574..9f115c05802 100644
--- a/lib/gitlab/ci/templates/Python.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Python.gitlab-ci.yml
@@ -48,4 +48,5 @@ pages:
paths:
- public
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/templates/Swift.gitlab-ci.yml b/lib/gitlab/ci/templates/Swift.gitlab-ci.yml
index ffed7a0fec2..f7b4552f8da 100644
--- a/lib/gitlab/ci/templates/Swift.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Swift.gitlab-ci.yml
@@ -22,7 +22,8 @@ archive_project:
- xcodebuild clean archive -archivePath build/ProjectName -scheme SchemeName
- xcodebuild -exportArchive -exportFormat ipa -archivePath "build/ProjectName.xcarchive" -exportPath "build/ProjectName.ipa" -exportProvisioningProfile "ProvisioningProfileName"
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
artifacts:
paths:
- build/ProjectName.ipa
diff --git a/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml b/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
index f374bc7e26a..85c5104eaad 100644
--- a/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
@@ -53,4 +53,5 @@ apply:
- plan
when: manual
only:
- - master
+ variables:
+ - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
diff --git a/lib/gitlab/ci/yaml_processor.rb b/lib/gitlab/ci/yaml_processor.rb
index f6a3abefcfb..c2a55fa8b1b 100644
--- a/lib/gitlab/ci/yaml_processor.rb
+++ b/lib/gitlab/ci/yaml_processor.rb
@@ -40,7 +40,7 @@ module Gitlab
environment: job[:environment_name],
coverage_regex: job[:coverage],
yaml_variables: yaml_variables(name),
- needs_attributes: job[:needs]&.map { |need| { name: need } },
+ needs_attributes: job.dig(:needs, :job),
interruptible: job[:interruptible],
rules: job[:rules],
options: {
@@ -59,7 +59,7 @@ module Gitlab
instance: job[:instance],
start_in: job[:start_in],
trigger: job[:trigger],
- bridge_needs: job[:needs]
+ bridge_needs: job.dig(:needs, :bridge)&.first
}.compact }.compact
end
@@ -159,17 +159,19 @@ module Gitlab
end
def validate_job_needs!(name, job)
- return unless job[:needs]
+ return unless job.dig(:needs, :job)
stage_index = @stages.index(job[:stage])
- job[:needs].each do |need|
- raise ValidationError, "#{name} job: undefined need: #{need}" unless @jobs[need.to_sym]
+ job.dig(:needs, :job).each do |need|
+ need_job_name = need[:name]
- needs_stage_index = @stages.index(@jobs[need.to_sym][:stage])
+ raise ValidationError, "#{name} job: undefined need: #{need_job_name}" unless @jobs[need_job_name.to_sym]
+
+ needs_stage_index = @stages.index(@jobs[need_job_name.to_sym][:stage])
unless needs_stage_index.present? && needs_stage_index < stage_index
- raise ValidationError, "#{name} job: need #{need} is not defined in prior stages"
+ raise ValidationError, "#{name} job: need #{need_job_name} is not defined in prior stages"
end
end
end