Commit d8490ec6 authored by Kerri Miller's avatar Kerri Miller

Merge branch 'add-predefined-fips-variable' into 'master'

feat: Add CI_GITLAB_FIPS_MODE to predefined CI variables

See merge request gitlab-org/gitlab!83891
parents c0290a26 1a7a7017
......@@ -824,6 +824,8 @@ module Ci
variables.append(key: 'CI_OPEN_MERGE_REQUESTS', value: open_merge_requests_refs.join(','))
end
variables.append(key: 'CI_GITLAB_FIPS_MODE', value: 'true') if Gitlab::FIPS.enabled?
variables.append(key: 'CI_KUBERNETES_ACTIVE', value: 'true') if has_kubernetes_active?
variables.append(key: 'CI_DEPLOY_FREEZE', value: 'true') if freeze_period?
......
......@@ -58,6 +58,7 @@ There are also a number of [variables you can use to configure runner behavior](
| `CI_ENVIRONMENT_URL` | 9.3 | all | The URL of the environment for this job. Available if [`environment:url`](../yaml/index.md#environmenturl) is set. |
| `CI_ENVIRONMENT_ACTION` | 13.11 | all | The action annotation specified for this job's environment. Available if [`environment:action`](../yaml/index.md#environmentaction) is set. Can be `start`, `prepare`, or `stop`. |
| `CI_ENVIRONMENT_TIER` | 14.0 | all | The [deployment tier of the environment](../environments/index.md#deployment-tier-of-environments) for this job. |
| `CI_GITLAB_FIPS_MODE` | 14.10 | all | The configuration setting for whether FIPS mode is enabled in the GitLab instance. |
| `CI_HAS_OPEN_REQUIREMENTS` | 13.1 | all | Only available if the pipeline's project has an open [requirement](../../user/project/requirements/index.md). `true` when available. |
| `CI_JOB_ID` | 9.0 | all | The internal ID of the job, unique across all jobs in the GitLab instance. |
| `CI_JOB_IMAGE` | 12.9 | 12.9 | The name of the Docker image running the job. |
......
......@@ -1146,6 +1146,28 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
end
end
end
describe 'variable CI_GITLAB_FIPS_MODE' do
context 'when FIPS flag is enabled' do
before do
allow(Gitlab::FIPS).to receive(:enabled?).and_return(true)
end
it "is included with value 'true'" do
expect(subject.to_hash).to include('CI_GITLAB_FIPS_MODE' => 'true')
end
end
context 'when FIPS flag is disabled' do
before do
allow(Gitlab::FIPS).to receive(:enabled?).and_return(false)
end
it 'is not included' do
expect(subject.to_hash).not_to have_key('CI_GITLAB_FIPS_MODE')
end
end
end
end
describe '#protected_ref?' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment