diff options
author | Matija Čupić <matija.cupic.97@gmail.com> | 2017-11-04 02:42:16 +0100 |
---|---|---|
committer | Matija Čupić <matija.cupic.97@gmail.com> | 2017-11-04 04:46:29 +0100 |
commit | 576f0a5a6d3819149590fad00986dee8c719db32 (patch) | |
tree | 164f9be368c0643b3134bf3e0d9e89929e4becf1 | |
parent | 5d4f377bfd50cb1b2b1980f036b18c7b5d2b137f (diff) | |
download | gitlab-ce-576f0a5a6d3819149590fad00986dee8c719db32.tar.gz |
Expose project visibility as CI variable
-rw-r--r-- | app/models/project.rb | 3 | ||||
-rw-r--r-- | changelogs/unreleased/37473-expose-project-visibility-as-ci-variable.yml | 5 | ||||
-rw-r--r-- | doc/ci/variables/README.md | 1 | ||||
-rw-r--r-- | spec/models/ci/build_spec.rb | 1 |
4 files changed, 9 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 2f9b80d0514..b04aec550b1 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1492,7 +1492,8 @@ class Project < ActiveRecord::Base { key: 'CI_PROJECT_PATH', value: full_path, public: true }, { key: 'CI_PROJECT_PATH_SLUG', value: full_path_slug, public: true }, { key: 'CI_PROJECT_NAMESPACE', value: namespace.full_path, public: true }, - { key: 'CI_PROJECT_URL', value: web_url, public: true } + { key: 'CI_PROJECT_URL', value: web_url, public: true }, + { key: 'CI_PROJECT_VISIBILITY', value: Gitlab::VisibilityLevel.string_level(visibility_level), public: true } ] end diff --git a/changelogs/unreleased/37473-expose-project-visibility-as-ci-variable.yml b/changelogs/unreleased/37473-expose-project-visibility-as-ci-variable.yml new file mode 100644 index 00000000000..f6906a3b0e0 --- /dev/null +++ b/changelogs/unreleased/37473-expose-project-visibility-as-ci-variable.yml @@ -0,0 +1,5 @@ +--- +title: Expose project visibility as CI variable - CI_PROJECT_VISIBILITY +merge_request: 15193 +author: +type: added diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md index 535ed351366..a9e6bda9916 100644 --- a/doc/ci/variables/README.md +++ b/doc/ci/variables/README.md @@ -66,6 +66,7 @@ future GitLab releases.** | **CI_PROJECT_PATH** | 8.10 | 0.5 | The namespace with project name | | **CI_PROJECT_PATH_SLUG** | 9.3 | all | `$CI_PROJECT_PATH` lowercased and with everything except `0-9` and `a-z` replaced with `-`. Use in URLs and domain names. | | **CI_PROJECT_URL** | 8.10 | 0.5 | The HTTP address to access project | +| **CI_PROJECT_VISIBILITY** | 10.3 | all | The project visibility (internal, private, public) | | **CI_REGISTRY** | 8.10 | 0.5 | If the Container Registry is enabled it returns the address of GitLab's Container Registry | | **CI_REGISTRY_IMAGE** | 8.10 | 0.5 | If the Container Registry is enabled for the project it returns the address of the registry tied to the specific project | | **CI_REGISTRY_PASSWORD** | 9.0 | all | The password to use to push containers to the GitLab Container Registry | diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 41ecdb604f1..f804b422794 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1271,6 +1271,7 @@ describe Ci::Build do { key: 'CI_PROJECT_PATH_SLUG', value: project.full_path_slug, public: true }, { key: 'CI_PROJECT_NAMESPACE', value: project.namespace.full_path, public: true }, { key: 'CI_PROJECT_URL', value: project.web_url, public: true }, + { key: 'CI_PROJECT_VISIBILITY', value: Gitlab::VisibilityLevel.string_level(project.visibility_level), public: true }, { key: 'CI_PIPELINE_ID', value: pipeline.id.to_s, public: true }, { key: 'CI_CONFIG_PATH', value: pipeline.ci_yaml_file_path, public: true }, { key: 'CI_REGISTRY_USER', value: 'gitlab-ci-token', public: true }, |