Commit 6bf24d00 authored by Aleksei Lipniagov's avatar Aleksei Lipniagov

Merge branch '357285-update-ruby27-specs' into 'master'

Change all ruby:2.7 occurrences to image:1.0 in /specs

See merge request gitlab-org/gitlab!84146
parents d3e2d080 8a174110
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Gitlab::Ci::Config::Required::Processor do RSpec.describe Gitlab::Ci::Config::Required::Processor do
subject { described_class.new(config).perform } subject { described_class.new(config).perform }
let(:config) { { image: 'ruby:3.0.1' } } let(:config) { { image: 'image:1.0.0' } }
context 'when feature is available' do context 'when feature is available' do
before do before do
......
...@@ -7,7 +7,7 @@ RSpec.describe Gitlab::Ci::Config::SecurityOrchestrationPolicies::Processor do ...@@ -7,7 +7,7 @@ RSpec.describe Gitlab::Ci::Config::SecurityOrchestrationPolicies::Processor do
subject { described_class.new(config, project, ref, source).perform } subject { described_class.new(config, project, ref, source).perform }
let_it_be(:config) { { image: 'ruby:3.0.1' } } let_it_be(:config) { { image: 'image:1.0.0' } }
let(:ref) { 'refs/heads/master' } let(:ref) { 'refs/heads/master' }
let(:source) { 'pipeline' } let(:source) { 'pipeline' }
...@@ -123,7 +123,7 @@ RSpec.describe Gitlab::Ci::Config::SecurityOrchestrationPolicies::Processor do ...@@ -123,7 +123,7 @@ RSpec.describe Gitlab::Ci::Config::SecurityOrchestrationPolicies::Processor do
it_behaves_like 'with different scan type' do it_behaves_like 'with different scan type' do
let(:expected_configuration) do let(:expected_configuration) do
{ {
image: 'ruby:3.0.1', image: 'image:1.0.0',
'dast-on-demand-0': { 'dast-on-demand-0': {
stage: 'dast', stage: 'dast',
image: { image: {
......
...@@ -10,7 +10,7 @@ FactoryBot.define do ...@@ -10,7 +10,7 @@ FactoryBot.define do
options do options do
{ {
image: 'ruby:2.7', image: 'image:1.0',
services: ['postgres'], services: ['postgres'],
script: ['ls -a'] script: ['ls -a']
} }
...@@ -493,7 +493,7 @@ FactoryBot.define do ...@@ -493,7 +493,7 @@ FactoryBot.define do
trait :extended_options do trait :extended_options do
options do options do
{ {
image: { name: 'ruby:2.7', entrypoint: '/bin/sh' }, image: { name: 'image:1.0', entrypoint: '/bin/sh' },
services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }, { name: 'mysql:latest', variables: { MYSQL_ROOT_PASSWORD: 'root123.' } }], services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }, { name: 'mysql:latest', variables: { MYSQL_ROOT_PASSWORD: 'root123.' } }],
script: %w(echo), script: %w(echo),
after_script: %w(ls date), after_script: %w(ls date),
......
...@@ -9,7 +9,7 @@ RSpec.describe Gitlab::Ci::Build::Image do ...@@ -9,7 +9,7 @@ RSpec.describe Gitlab::Ci::Build::Image do
subject { described_class.from_image(job) } subject { described_class.from_image(job) }
context 'when image is defined in job' do context 'when image is defined in job' do
let(:image_name) { 'ruby:2.7' } let(:image_name) { 'image:1.0' }
let(:job) { create(:ci_build, options: { image: image_name } ) } let(:job) { create(:ci_build, options: { image: image_name } ) }
context 'when image is defined as string' do context 'when image is defined as string' do
......
...@@ -6,11 +6,11 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do ...@@ -6,11 +6,11 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
let(:entry) { described_class.new(config) } let(:entry) { described_class.new(config) }
context 'when configuration is a string' do context 'when configuration is a string' do
let(:config) { 'ruby:2.7' } let(:config) { 'image:1.0' }
describe '#value' do describe '#value' do
it 'returns image hash' do it 'returns image hash' do
expect(entry.value).to eq({ name: 'ruby:2.7' }) expect(entry.value).to eq({ name: 'image:1.0' })
end end
end end
...@@ -28,7 +28,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do ...@@ -28,7 +28,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
describe '#image' do describe '#image' do
it "returns image's name" do it "returns image's name" do
expect(entry.name).to eq 'ruby:2.7' expect(entry.name).to eq 'image:1.0'
end end
end end
...@@ -46,7 +46,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do ...@@ -46,7 +46,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
end end
context 'when configuration is a hash' do context 'when configuration is a hash' do
let(:config) { { name: 'ruby:2.7', entrypoint: %w(/bin/sh run) } } let(:config) { { name: 'image:1.0', entrypoint: %w(/bin/sh run) } }
describe '#value' do describe '#value' do
it 'returns image hash' do it 'returns image hash' do
...@@ -68,7 +68,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do ...@@ -68,7 +68,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
describe '#image' do describe '#image' do
it "returns image's name" do it "returns image's name" do
expect(entry.name).to eq 'ruby:2.7' expect(entry.name).to eq 'image:1.0'
end end
end end
...@@ -80,7 +80,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do ...@@ -80,7 +80,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
context 'when configuration has ports' do context 'when configuration has ports' do
let(:ports) { [{ number: 80, protocol: 'http', name: 'foobar' }] } let(:ports) { [{ number: 80, protocol: 'http', name: 'foobar' }] }
let(:config) { { name: 'ruby:2.7', entrypoint: %w(/bin/sh run), ports: ports } } let(:config) { { name: 'image:1.0', entrypoint: %w(/bin/sh run), ports: ports } }
let(:entry) { described_class.new(config, with_image_ports: image_ports) } let(:entry) { described_class.new(config, with_image_ports: image_ports) }
let(:image_ports) { false } let(:image_ports) { false }
...@@ -112,7 +112,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do ...@@ -112,7 +112,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
end end
context 'when entry value is not correct' do context 'when entry value is not correct' do
let(:config) { ['ruby:2.7'] } let(:config) { ['image:1.0'] }
describe '#errors' do describe '#errors' do
it 'saves errors' do it 'saves errors' do
...@@ -129,7 +129,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do ...@@ -129,7 +129,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
end end
context 'when unexpected key is specified' do context 'when unexpected key is specified' do
let(:config) { { name: 'ruby:2.7', non_existing: 'test' } } let(:config) { { name: 'image:1.0', non_existing: 'test' } }
describe '#errors' do describe '#errors' do
it 'saves errors' do it 'saves errors' do
......
...@@ -31,7 +31,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do ...@@ -31,7 +31,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
let(:hash) do let(:hash) do
{ {
before_script: %w(ls pwd), before_script: %w(ls pwd),
image: 'ruby:2.7', image: 'image:1.0',
default: {}, default: {},
services: ['postgres:9.1', 'mysql:5.5'], services: ['postgres:9.1', 'mysql:5.5'],
variables: { VAR: 'root', VAR2: { value: 'val 2', description: 'this is var 2' } }, variables: { VAR: 'root', VAR2: { value: 'val 2', description: 'this is var 2' } },
...@@ -154,7 +154,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do ...@@ -154,7 +154,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
{ name: :rspec, { name: :rspec,
script: %w[rspec ls], script: %w[rspec ls],
before_script: %w(ls pwd), before_script: %w(ls pwd),
image: { name: 'ruby:2.7' }, image: { name: 'image:1.0' },
services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }],
stage: 'test', stage: 'test',
cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }],
...@@ -169,7 +169,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do ...@@ -169,7 +169,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
{ name: :spinach, { name: :spinach,
before_script: [], before_script: [],
script: %w[spinach], script: %w[spinach],
image: { name: 'ruby:2.7' }, image: { name: 'image:1.0' },
services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }],
stage: 'test', stage: 'test',
cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }],
...@@ -186,7 +186,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do ...@@ -186,7 +186,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
before_script: [], before_script: [],
script: ["make changelog | tee release_changelog.txt"], script: ["make changelog | tee release_changelog.txt"],
release: { name: "Release $CI_TAG_NAME", tag_name: 'v0.06', description: "./release_changelog.txt" }, release: { name: "Release $CI_TAG_NAME", tag_name: 'v0.06', description: "./release_changelog.txt" },
image: { name: "ruby:2.7" }, image: { name: "image:1.0" },
services: [{ name: "postgres:9.1" }, { name: "mysql:5.5" }], services: [{ name: "postgres:9.1" }, { name: "mysql:5.5" }],
cache: [{ key: "k", untracked: true, paths: ["public/"], policy: "pull-push", when: 'on_success' }], cache: [{ key: "k", untracked: true, paths: ["public/"], policy: "pull-push", when: 'on_success' }],
only: { refs: %w(branches tags) }, only: { refs: %w(branches tags) },
...@@ -206,7 +206,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do ...@@ -206,7 +206,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
{ before_script: %w(ls pwd), { before_script: %w(ls pwd),
after_script: ['make clean'], after_script: ['make clean'],
default: { default: {
image: 'ruby:2.7', image: 'image:1.0',
services: ['postgres:9.1', 'mysql:5.5'] services: ['postgres:9.1', 'mysql:5.5']
}, },
variables: { VAR: 'root' }, variables: { VAR: 'root' },
...@@ -233,7 +233,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do ...@@ -233,7 +233,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
rspec: { name: :rspec, rspec: { name: :rspec,
script: %w[rspec ls], script: %w[rspec ls],
before_script: %w(ls pwd), before_script: %w(ls pwd),
image: { name: 'ruby:2.7' }, image: { name: 'image:1.0' },
services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }],
stage: 'test', stage: 'test',
cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }],
...@@ -246,7 +246,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do ...@@ -246,7 +246,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
spinach: { name: :spinach, spinach: { name: :spinach,
before_script: [], before_script: [],
script: %w[spinach], script: %w[spinach],
image: { name: 'ruby:2.7' }, image: { name: 'image:1.0' },
services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }],
stage: 'test', stage: 'test',
cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }],
......
...@@ -79,7 +79,7 @@ RSpec.describe Gitlab::Ci::Config::External::File::Project do ...@@ -79,7 +79,7 @@ RSpec.describe Gitlab::Ci::Config::External::File::Project do
let(:root_ref_sha) { project.repository.root_ref_sha } let(:root_ref_sha) { project.repository.root_ref_sha }
before do before do
stub_project_blob(root_ref_sha, '/file.yml') { 'image: ruby:2.7' } stub_project_blob(root_ref_sha, '/file.yml') { 'image: image:1.0' }
end end
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
...@@ -102,7 +102,7 @@ RSpec.describe Gitlab::Ci::Config::External::File::Project do ...@@ -102,7 +102,7 @@ RSpec.describe Gitlab::Ci::Config::External::File::Project do
let(:ref_sha) { project.commit('master').sha } let(:ref_sha) { project.commit('master').sha }
before do before do
stub_project_blob(ref_sha, '/file.yml') { 'image: ruby:2.7' } stub_project_blob(ref_sha, '/file.yml') { 'image: image:1.0' }
end end
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
......
...@@ -17,7 +17,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -17,7 +17,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
let(:file_content) do let(:file_content) do
<<~HEREDOC <<~HEREDOC
image: 'ruby:2.7' image: 'image:1.0'
HEREDOC HEREDOC
end end
...@@ -36,7 +36,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -36,7 +36,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when the string is a local file' do context 'when the string is a local file' do
let(:values) do let(:values) do
{ include: local_file, { include: local_file,
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
...@@ -48,7 +48,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -48,7 +48,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when the key is a local file hash' do context 'when the key is a local file hash' do
let(:values) do let(:values) do
{ include: { 'local' => local_file }, { include: { 'local' => local_file },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
...@@ -59,7 +59,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -59,7 +59,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when the string is a remote file' do context 'when the string is a remote file' do
let(:values) do let(:values) do
{ include: remote_url, image: 'ruby:2.7' } { include: remote_url, image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
...@@ -71,7 +71,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -71,7 +71,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when the key is a remote file hash' do context 'when the key is a remote file hash' do
let(:values) do let(:values) do
{ include: { 'remote' => remote_url }, { include: { 'remote' => remote_url },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
...@@ -83,7 +83,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -83,7 +83,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when the key is a template file hash' do context 'when the key is a template file hash' do
let(:values) do let(:values) do
{ include: { 'template' => template_file }, { include: { 'template' => template_file },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
...@@ -98,7 +98,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -98,7 +98,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
let(:remote_url) { 'https://gitlab.com/secret-file.yml' } let(:remote_url) { 'https://gitlab.com/secret-file.yml' }
let(:values) do let(:values) do
{ include: { 'local' => local_file, 'remote' => remote_url }, { include: { 'local' => local_file, 'remote' => remote_url },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns ambigious specification error' do it 'returns ambigious specification error' do
...@@ -109,7 +109,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -109,7 +109,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context "when the key is a project's file" do context "when the key is a project's file" do
let(:values) do let(:values) do
{ include: { project: project.full_path, file: local_file }, { include: { project: project.full_path, file: local_file },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
...@@ -121,7 +121,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -121,7 +121,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context "when the key is project's files" do context "when the key is project's files" do
let(:values) do let(:values) do
{ include: { project: project.full_path, file: [local_file, 'another_file_path.yml'] }, { include: { project: project.full_path, file: [local_file, 'another_file_path.yml'] },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns two File instances' do it 'returns two File instances' do
...@@ -135,7 +135,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -135,7 +135,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context "when 'include' is defined as an array" do context "when 'include' is defined as an array" do
let(:values) do let(:values) do
{ include: [remote_url, local_file], { include: [remote_url, local_file],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns Files instances' do it 'returns Files instances' do
...@@ -147,7 +147,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -147,7 +147,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context "when 'include' is defined as an array of hashes" do context "when 'include' is defined as an array of hashes" do
let(:values) do let(:values) do
{ include: [{ remote: remote_url }, { local: local_file }], { include: [{ remote: remote_url }, { local: local_file }],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns Files instances' do it 'returns Files instances' do
...@@ -158,7 +158,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -158,7 +158,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when it has ambigious match' do context 'when it has ambigious match' do
let(:values) do let(:values) do
{ include: [{ remote: remote_url, local: local_file }], { include: [{ remote: remote_url, local: local_file }],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns ambigious specification error' do it 'returns ambigious specification error' do
...@@ -170,7 +170,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -170,7 +170,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context "when 'include' is not defined" do context "when 'include' is not defined" do
let(:values) do let(:values) do
{ {
image: 'ruby:2.7' image: 'image:1.0'
} }
end end
...@@ -185,7 +185,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -185,7 +185,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
{ 'local' => local_file }, { 'local' => local_file },
{ 'local' => local_file } { 'local' => local_file }
], ],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'does not raise an exception' do it 'does not raise an exception' do
...@@ -199,7 +199,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -199,7 +199,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
{ 'local' => local_file }, { 'local' => local_file },
{ 'remote' => remote_url } { 'remote' => remote_url }
], ],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
before do before do
...@@ -217,7 +217,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -217,7 +217,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
{ 'local' => local_file }, { 'local' => local_file },
{ 'remote' => remote_url } { 'remote' => remote_url }
], ],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
before do before do
...@@ -269,7 +269,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -269,7 +269,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'defined as an array' do context 'defined as an array' do
let(:values) do let(:values) do
{ include: [full_local_file_path, remote_url], { include: [full_local_file_path, remote_url],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'expands the variable' do it 'expands the variable' do
...@@ -281,7 +281,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -281,7 +281,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'defined as an array of hashes' do context 'defined as an array of hashes' do
let(:values) do let(:values) do
{ include: [{ local: full_local_file_path }, { remote: remote_url }], { include: [{ local: full_local_file_path }, { remote: remote_url }],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'expands the variable' do it 'expands the variable' do
...@@ -303,7 +303,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -303,7 +303,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'project name' do context 'project name' do
let(:values) do let(:values) do
{ include: { project: '$CI_PROJECT_PATH', file: local_file }, { include: { project: '$CI_PROJECT_PATH', file: local_file },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'expands the variable', :aggregate_failures do it 'expands the variable', :aggregate_failures do
...@@ -315,7 +315,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -315,7 +315,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'with multiple files' do context 'with multiple files' do
let(:values) do let(:values) do
{ include: { project: project.full_path, file: [full_local_file_path, 'another_file_path.yml'] }, { include: { project: project.full_path, file: [full_local_file_path, 'another_file_path.yml'] },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'expands the variable' do it 'expands the variable' do
...@@ -327,7 +327,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -327,7 +327,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when include variable has an unsupported type for variable expansion' do context 'when include variable has an unsupported type for variable expansion' do
let(:values) do let(:values) do
{ include: { project: project.id, file: local_file }, { include: { project: project.id, file: local_file },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'does not invoke expansion for the variable', :aggregate_failures do it 'does not invoke expansion for the variable', :aggregate_failures do
...@@ -365,7 +365,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do ...@@ -365,7 +365,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
let(:values) do let(:values) do
{ include: [{ remote: remote_url }, { include: [{ remote: remote_url },
{ local: local_file, rules: [{ if: "$CI_PROJECT_ID == '#{project_id}'" }] }], { local: local_file, rules: [{ if: "$CI_PROJECT_ID == '#{project_id}'" }] }],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
context 'when the rules matches' do context 'when the rules matches' do
......
...@@ -25,7 +25,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -25,7 +25,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
subject { processor.perform } subject { processor.perform }
context 'when no external files defined' do context 'when no external files defined' do
let(:values) { { image: 'ruby:2.7' } } let(:values) { { image: 'image:1.0' } }
it 'returns the same values' do it 'returns the same values' do
expect(processor.perform).to eq(values) expect(processor.perform).to eq(values)
...@@ -33,7 +33,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -33,7 +33,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
end end
context 'when an invalid local file is defined' do context 'when an invalid local file is defined' do
let(:values) { { include: '/lib/gitlab/ci/templates/non-existent-file.yml', image: 'ruby:2.7' } } let(:values) { { include: '/lib/gitlab/ci/templates/non-existent-file.yml', image: 'image:1.0' } }
it 'raises an error' do it 'raises an error' do
expect { processor.perform }.to raise_error( expect { processor.perform }.to raise_error(
...@@ -45,7 +45,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -45,7 +45,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
context 'when an invalid remote file is defined' do context 'when an invalid remote file is defined' do
let(:remote_file) { 'http://doesntexist.com/.gitlab-ci-1.yml' } let(:remote_file) { 'http://doesntexist.com/.gitlab-ci-1.yml' }
let(:values) { { include: remote_file, image: 'ruby:2.7' } } let(:values) { { include: remote_file, image: 'image:1.0' } }
before do before do
stub_full_request(remote_file).and_raise(SocketError.new('Some HTTP error')) stub_full_request(remote_file).and_raise(SocketError.new('Some HTTP error'))
...@@ -61,7 +61,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -61,7 +61,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
context 'with a valid remote external file is defined' do context 'with a valid remote external file is defined' do
let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' }
let(:values) { { include: remote_file, image: 'ruby:2.7' } } let(:values) { { include: remote_file, image: 'image:1.0' } }
let(:external_file_content) do let(:external_file_content) do
<<-HEREDOC <<-HEREDOC
before_script: before_script:
...@@ -95,7 +95,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -95,7 +95,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
end end
context 'with a valid local external file is defined' do context 'with a valid local external file is defined' do
let(:values) { { include: '/lib/gitlab/ci/templates/template.yml', image: 'ruby:2.7' } } let(:values) { { include: '/lib/gitlab/ci/templates/template.yml', image: 'image:1.0' } }
let(:local_file_content) do let(:local_file_content) do
<<-HEREDOC <<-HEREDOC
before_script: before_script:
...@@ -133,7 +133,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -133,7 +133,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
let(:values) do let(:values) do
{ {
include: external_files, include: external_files,
image: 'ruby:2.7' image: 'image:1.0'
} }
end end
...@@ -165,7 +165,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -165,7 +165,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
end end
context 'when external files are defined but not valid' do context 'when external files are defined but not valid' do
let(:values) { { include: '/lib/gitlab/ci/templates/template.yml', image: 'ruby:2.7' } } let(:values) { { include: '/lib/gitlab/ci/templates/template.yml', image: 'image:1.0' } }
let(:local_file_content) { 'invalid content file ////' } let(:local_file_content) { 'invalid content file ////' }
...@@ -187,7 +187,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -187,7 +187,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
let(:values) do let(:values) do
{ {
include: remote_file, include: remote_file,
image: 'ruby:2.7' image: 'image:1.0'
} }
end end
...@@ -200,7 +200,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -200,7 +200,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
it 'takes precedence' do it 'takes precedence' do
stub_full_request(remote_file).to_return(body: remote_file_content) stub_full_request(remote_file).to_return(body: remote_file_content)
expect(processor.perform[:image]).to eq('ruby:2.7') expect(processor.perform[:image]).to eq('image:1.0')
end end
end end
...@@ -210,7 +210,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -210,7 +210,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
include: [ include: [
{ local: '/local/file.yml' } { local: '/local/file.yml' }
], ],
image: 'ruby:2.7' image: 'image:1.0'
} }
end end
...@@ -294,7 +294,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -294,7 +294,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
context 'when config includes an external configuration file via SSL web request' do context 'when config includes an external configuration file via SSL web request' do
before do before do
stub_full_request('https://sha256.badssl.com/fake.yml', ip_address: '8.8.8.8') stub_full_request('https://sha256.badssl.com/fake.yml', ip_address: '8.8.8.8')
.to_return(body: 'image: ruby:2.6', status: 200) .to_return(body: 'image: image:1.0', status: 200)
stub_full_request('https://self-signed.badssl.com/fake.yml', ip_address: '8.8.8.9') stub_full_request('https://self-signed.badssl.com/fake.yml', ip_address: '8.8.8.9')
.to_raise(OpenSSL::SSL::SSLError.new('SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate)')) .to_raise(OpenSSL::SSL::SSLError.new('SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate)'))
...@@ -303,7 +303,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -303,7 +303,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
context 'with an acceptable certificate' do context 'with an acceptable certificate' do
let(:values) { { include: 'https://sha256.badssl.com/fake.yml' } } let(:values) { { include: 'https://sha256.badssl.com/fake.yml' } }
it { is_expected.to include(image: 'ruby:2.6') } it { is_expected.to include(image: 'image:1.0') }
end end
context 'with a self-signed certificate' do context 'with a self-signed certificate' do
...@@ -319,7 +319,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -319,7 +319,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
let(:values) do let(:values) do
{ {
include: { project: another_project.full_path, file: '/templates/my-build.yml' }, include: { project: another_project.full_path, file: '/templates/my-build.yml' },
image: 'ruby:2.7' image: 'image:1.0'
} }
end end
...@@ -349,7 +349,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -349,7 +349,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
project: another_project.full_path, project: another_project.full_path,
file: ['/templates/my-build.yml', '/templates/my-test.yml'] file: ['/templates/my-build.yml', '/templates/my-test.yml']
}, },
image: 'ruby:2.7' image: 'image:1.0'
} }
end end
...@@ -383,7 +383,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do ...@@ -383,7 +383,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let(:values) do let(:values) do
{ include: 'myfolder/*.yml', image: 'ruby:2.7' } { include: 'myfolder/*.yml', image: 'image:1.0' }
end end
before do before do
......
...@@ -20,7 +20,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -20,7 +20,7 @@ RSpec.describe Gitlab::Ci::Config do
context 'when config is valid' do context 'when config is valid' do
let(:yml) do let(:yml) do
<<-EOS <<-EOS
image: ruby:2.7 image: image:1.0
rspec: rspec:
script: script:
...@@ -32,7 +32,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -32,7 +32,7 @@ RSpec.describe Gitlab::Ci::Config do
describe '#to_hash' do describe '#to_hash' do
it 'returns hash created from string' do it 'returns hash created from string' do
hash = { hash = {
image: 'ruby:2.7', image: 'image:1.0',
rspec: { rspec: {
script: ['gem install rspec', script: ['gem install rspec',
'rspec'] 'rspec']
...@@ -109,7 +109,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -109,7 +109,7 @@ RSpec.describe Gitlab::Ci::Config do
context 'when using extendable hash' do context 'when using extendable hash' do
let(:yml) do let(:yml) do
<<-EOS <<-EOS
image: ruby:2.7 image: image:1.0
rspec: rspec:
script: rspec script: rspec
...@@ -122,7 +122,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -122,7 +122,7 @@ RSpec.describe Gitlab::Ci::Config do
it 'correctly extends the hash' do it 'correctly extends the hash' do
hash = { hash = {
image: 'ruby:2.7', image: 'image:1.0',
rspec: { script: 'rspec' }, rspec: { script: 'rspec' },
test: { test: {
extends: 'rspec', extends: 'rspec',
...@@ -212,7 +212,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -212,7 +212,7 @@ RSpec.describe Gitlab::Ci::Config do
let(:yml) do let(:yml) do
<<-EOS <<-EOS
image: image:
name: ruby:2.7 name: image:1.0
ports: ports:
- 80 - 80
EOS EOS
...@@ -226,12 +226,12 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -226,12 +226,12 @@ RSpec.describe Gitlab::Ci::Config do
context 'in the job image' do context 'in the job image' do
let(:yml) do let(:yml) do
<<-EOS <<-EOS
image: ruby:2.7 image: image:1.0
test: test:
script: rspec script: rspec
image: image:
name: ruby:2.7 name: image:1.0
ports: ports:
- 80 - 80
EOS EOS
...@@ -245,11 +245,11 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -245,11 +245,11 @@ RSpec.describe Gitlab::Ci::Config do
context 'in the services' do context 'in the services' do
let(:yml) do let(:yml) do
<<-EOS <<-EOS
image: ruby:2.7 image: image:1.0
test: test:
script: rspec script: rspec
image: ruby:2.7 image: image:1.0
services: services:
- name: test - name: test
alias: test alias: test
...@@ -325,7 +325,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -325,7 +325,7 @@ RSpec.describe Gitlab::Ci::Config do
- project: '$MAIN_PROJECT' - project: '$MAIN_PROJECT'
ref: '$REF' ref: '$REF'
file: '$FILENAME' file: '$FILENAME'
image: ruby:2.7 image: image:1.0
HEREDOC HEREDOC
end end
...@@ -364,7 +364,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -364,7 +364,7 @@ RSpec.describe Gitlab::Ci::Config do
it 'returns a composed hash' do it 'returns a composed hash' do
composed_hash = { composed_hash = {
before_script: local_location_hash[:before_script], before_script: local_location_hash[:before_script],
image: "ruby:2.7", image: "image:1.0",
rspec: { script: ["bundle exec rspec"] }, rspec: { script: ["bundle exec rspec"] },
variables: remote_file_hash[:variables] variables: remote_file_hash[:variables]
} }
...@@ -481,7 +481,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -481,7 +481,7 @@ RSpec.describe Gitlab::Ci::Config do
include: include:
- #{remote_location} - #{remote_location}
image: ruby:2.7 image: image:1.0
HEREDOC HEREDOC
end end
...@@ -492,7 +492,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -492,7 +492,7 @@ RSpec.describe Gitlab::Ci::Config do
end end
it 'takes precedence' do it 'takes precedence' do
expect(config.to_hash).to eq({ image: 'ruby:2.7' }) expect(config.to_hash).to eq({ image: 'image:1.0' })
end end
end end
...@@ -699,7 +699,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -699,7 +699,7 @@ RSpec.describe Gitlab::Ci::Config do
- #{local_location} - #{local_location}
- #{other_file_location} - #{other_file_location}
image: ruby:2.7 image: image:1.0
HEREDOC HEREDOC
end end
...@@ -718,7 +718,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -718,7 +718,7 @@ RSpec.describe Gitlab::Ci::Config do
it 'returns a composed hash' do it 'returns a composed hash' do
composed_hash = { composed_hash = {
before_script: local_location_hash[:before_script], before_script: local_location_hash[:before_script],
image: "ruby:2.7", image: "image:1.0",
build: { stage: "build", script: "echo hello" }, build: { stage: "build", script: "echo hello" },
rspec: { stage: "test", script: "bundle exec rspec" } rspec: { stage: "test", script: "bundle exec rspec" }
} }
...@@ -735,7 +735,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -735,7 +735,7 @@ RSpec.describe Gitlab::Ci::Config do
- local: #{local_location} - local: #{local_location}
rules: rules:
- if: $CI_PROJECT_ID == "#{project_id}" - if: $CI_PROJECT_ID == "#{project_id}"
image: ruby:2.7 image: image:1.0
HEREDOC HEREDOC
end end
...@@ -763,7 +763,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -763,7 +763,7 @@ RSpec.describe Gitlab::Ci::Config do
- local: #{local_location} - local: #{local_location}
rules: rules:
- exists: "#{filename}" - exists: "#{filename}"
image: ruby:2.7 image: image:1.0
HEREDOC HEREDOC
end end
......
...@@ -842,7 +842,7 @@ module Gitlab ...@@ -842,7 +842,7 @@ module Gitlab
describe "Image and service handling" do describe "Image and service handling" do
context "when extended docker configuration is used" do context "when extended docker configuration is used" do
it "returns image and service when defined" do it "returns image and service when defined" do
config = YAML.dump({ image: { name: "ruby:2.7", entrypoint: ["/usr/local/bin/init", "run"] }, config = YAML.dump({ image: { name: "image:1.0", entrypoint: ["/usr/local/bin/init", "run"] },
services: ["mysql", { name: "docker:dind", alias: "docker", services: ["mysql", { name: "docker:dind", alias: "docker",
entrypoint: ["/usr/local/bin/init", "run"], entrypoint: ["/usr/local/bin/init", "run"],
command: ["/usr/local/bin/init", "run"] }], command: ["/usr/local/bin/init", "run"] }],
...@@ -860,7 +860,7 @@ module Gitlab ...@@ -860,7 +860,7 @@ module Gitlab
options: { options: {
before_script: ["pwd"], before_script: ["pwd"],
script: ["rspec"], script: ["rspec"],
image: { name: "ruby:2.7", entrypoint: ["/usr/local/bin/init", "run"] }, image: { name: "image:1.0", entrypoint: ["/usr/local/bin/init", "run"] },
services: [{ name: "mysql" }, services: [{ name: "mysql" },
{ name: "docker:dind", alias: "docker", entrypoint: ["/usr/local/bin/init", "run"], { name: "docker:dind", alias: "docker", entrypoint: ["/usr/local/bin/init", "run"],
command: ["/usr/local/bin/init", "run"] }] command: ["/usr/local/bin/init", "run"] }]
...@@ -874,10 +874,10 @@ module Gitlab ...@@ -874,10 +874,10 @@ module Gitlab
end end
it "returns image and service when overridden for job" do it "returns image and service when overridden for job" do
config = YAML.dump({ image: "ruby:2.7", config = YAML.dump({ image: "image:1.0",
services: ["mysql"], services: ["mysql"],
before_script: ["pwd"], before_script: ["pwd"],
rspec: { image: { name: "ruby:3.0", entrypoint: ["/usr/local/bin/init", "run"] }, rspec: { image: { name: "image:1.0", entrypoint: ["/usr/local/bin/init", "run"] },
services: [{ name: "postgresql", alias: "db-pg", services: [{ name: "postgresql", alias: "db-pg",
entrypoint: ["/usr/local/bin/init", "run"], entrypoint: ["/usr/local/bin/init", "run"],
command: ["/usr/local/bin/init", "run"] }, "docker:dind"], command: ["/usr/local/bin/init", "run"] }, "docker:dind"],
...@@ -894,7 +894,7 @@ module Gitlab ...@@ -894,7 +894,7 @@ module Gitlab
options: { options: {
before_script: ["pwd"], before_script: ["pwd"],
script: ["rspec"], script: ["rspec"],
image: { name: "ruby:3.0", entrypoint: ["/usr/local/bin/init", "run"] }, image: { name: "image:1.0", entrypoint: ["/usr/local/bin/init", "run"] },
services: [{ name: "postgresql", alias: "db-pg", entrypoint: ["/usr/local/bin/init", "run"], services: [{ name: "postgresql", alias: "db-pg", entrypoint: ["/usr/local/bin/init", "run"],
command: ["/usr/local/bin/init", "run"] }, command: ["/usr/local/bin/init", "run"] },
{ name: "docker:dind" }] { name: "docker:dind" }]
...@@ -910,7 +910,7 @@ module Gitlab ...@@ -910,7 +910,7 @@ module Gitlab
context "when etended docker configuration is not used" do context "when etended docker configuration is not used" do
it "returns image and service when defined" do it "returns image and service when defined" do
config = YAML.dump({ image: "ruby:2.7", config = YAML.dump({ image: "image:1.0",
services: ["mysql", "docker:dind"], services: ["mysql", "docker:dind"],
before_script: ["pwd"], before_script: ["pwd"],
rspec: { script: "rspec" } }) rspec: { script: "rspec" } })
...@@ -926,7 +926,7 @@ module Gitlab ...@@ -926,7 +926,7 @@ module Gitlab
options: { options: {
before_script: ["pwd"], before_script: ["pwd"],
script: ["rspec"], script: ["rspec"],
image: { name: "ruby:2.7" }, image: { name: "image:1.0" },
services: [{ name: "mysql" }, { name: "docker:dind" }] services: [{ name: "mysql" }, { name: "docker:dind" }]
}, },
allow_failure: false, allow_failure: false,
...@@ -938,10 +938,10 @@ module Gitlab ...@@ -938,10 +938,10 @@ module Gitlab
end end
it "returns image and service when overridden for job" do it "returns image and service when overridden for job" do
config = YAML.dump({ image: "ruby:2.7", config = YAML.dump({ image: "image:1.0",
services: ["mysql"], services: ["mysql"],
before_script: ["pwd"], before_script: ["pwd"],
rspec: { image: "ruby:3.0", services: ["postgresql", "docker:dind"], script: "rspec" } }) rspec: { image: "image:1.0", services: ["postgresql", "docker:dind"], script: "rspec" } })
config_processor = Gitlab::Ci::YamlProcessor.new(config).execute config_processor = Gitlab::Ci::YamlProcessor.new(config).execute
...@@ -954,7 +954,7 @@ module Gitlab ...@@ -954,7 +954,7 @@ module Gitlab
options: { options: {
before_script: ["pwd"], before_script: ["pwd"],
script: ["rspec"], script: ["rspec"],
image: { name: "ruby:3.0" }, image: { name: "image:1.0" },
services: [{ name: "postgresql" }, { name: "docker:dind" }] services: [{ name: "postgresql" }, { name: "docker:dind" }]
}, },
allow_failure: false, allow_failure: false,
...@@ -1557,7 +1557,7 @@ module Gitlab ...@@ -1557,7 +1557,7 @@ module Gitlab
describe "Artifacts" do describe "Artifacts" do
it "returns artifacts when defined" do it "returns artifacts when defined" do
config = YAML.dump({ config = YAML.dump({
image: "ruby:2.7", image: "image:1.0",
services: ["mysql"], services: ["mysql"],
before_script: ["pwd"], before_script: ["pwd"],
rspec: { rspec: {
...@@ -1583,7 +1583,7 @@ module Gitlab ...@@ -1583,7 +1583,7 @@ module Gitlab
options: { options: {
before_script: ["pwd"], before_script: ["pwd"],
script: ["rspec"], script: ["rspec"],
image: { name: "ruby:2.7" }, image: { name: "image:1.0" },
services: [{ name: "mysql" }], services: [{ name: "mysql" }],
artifacts: { artifacts: {
name: "custom_name", name: "custom_name",
...@@ -2327,7 +2327,7 @@ module Gitlab ...@@ -2327,7 +2327,7 @@ module Gitlab
context 'when hidden job have a script definition' do context 'when hidden job have a script definition' do
let(:config) do let(:config) do
YAML.dump({ YAML.dump({
'.hidden_job' => { image: 'ruby:2.7', script: 'test' }, '.hidden_job' => { image: 'image:1.0', script: 'test' },
'normal_job' => { script: 'test' } 'normal_job' => { script: 'test' }
}) })
end end
...@@ -2338,7 +2338,7 @@ module Gitlab ...@@ -2338,7 +2338,7 @@ module Gitlab
context "when hidden job doesn't have a script definition" do context "when hidden job doesn't have a script definition" do
let(:config) do let(:config) do
YAML.dump({ YAML.dump({
'.hidden_job' => { image: 'ruby:2.7' }, '.hidden_job' => { image: 'image:1.0' },
'normal_job' => { script: 'test' } 'normal_job' => { script: 'test' }
}) })
end end
......
...@@ -7,7 +7,7 @@ RSpec.describe Gitlab::Config::Loader::Yaml do ...@@ -7,7 +7,7 @@ RSpec.describe Gitlab::Config::Loader::Yaml do
let(:yml) do let(:yml) do
<<~YAML <<~YAML
image: 'ruby:2.7' image: 'image:1.0'
texts: texts:
nested_key: 'value1' nested_key: 'value1'
more_text: more_text:
...@@ -34,7 +34,7 @@ RSpec.describe Gitlab::Config::Loader::Yaml do ...@@ -34,7 +34,7 @@ RSpec.describe Gitlab::Config::Loader::Yaml do
end end
context 'when yaml syntax is correct' do context 'when yaml syntax is correct' do
let(:yml) { 'image: ruby:2.7' } let(:yml) { 'image: image:1.0' }
describe '#valid?' do describe '#valid?' do
it 'returns true' do it 'returns true' do
...@@ -44,7 +44,7 @@ RSpec.describe Gitlab::Config::Loader::Yaml do ...@@ -44,7 +44,7 @@ RSpec.describe Gitlab::Config::Loader::Yaml do
describe '#load!' do describe '#load!' do
it 'returns a valid hash' do it 'returns a valid hash' do
expect(loader.load!).to eq(image: 'ruby:2.7') expect(loader.load!).to eq(image: 'image:1.0')
end end
end end
end end
...@@ -164,7 +164,7 @@ RSpec.describe Gitlab::Config::Loader::Yaml do ...@@ -164,7 +164,7 @@ RSpec.describe Gitlab::Config::Loader::Yaml do
describe '#load_raw!' do describe '#load_raw!' do
it 'loads keys as strings' do it 'loads keys as strings' do
expect(loader.load_raw!).to eq( expect(loader.load_raw!).to eq(
'image' => 'ruby:2.7', 'image' => 'image:1.0',
'texts' => { 'texts' => {
'nested_key' => 'value1', 'nested_key' => 'value1',
'more_text' => { 'more_text' => {
...@@ -178,7 +178,7 @@ RSpec.describe Gitlab::Config::Loader::Yaml do ...@@ -178,7 +178,7 @@ RSpec.describe Gitlab::Config::Loader::Yaml do
describe '#load!' do describe '#load!' do
it 'symbolizes keys' do it 'symbolizes keys' do
expect(loader.load!).to eq( expect(loader.load!).to eq(
image: 'ruby:2.7', image: 'image:1.0',
texts: { texts: {
nested_key: 'value1', nested_key: 'value1',
more_text: { more_text: {
......
...@@ -557,7 +557,7 @@ RSpec.describe Gitlab::PathRegex do ...@@ -557,7 +557,7 @@ RSpec.describe Gitlab::PathRegex do
end end
it 'does not match other non-word characters' do it 'does not match other non-word characters' do
expect(subject.match('ruby:2.7.0')[0]).to eq('ruby') expect(subject.match('image:1.0.0')[0]).to eq('image')
end end
end end
......
...@@ -132,7 +132,7 @@ RSpec.describe Gitlab::WebIde::Config::Entry::Terminal do ...@@ -132,7 +132,7 @@ RSpec.describe Gitlab::WebIde::Config::Entry::Terminal do
{ before_script: %w[ls pwd], { before_script: %w[ls pwd],
script: 'sleep 100', script: 'sleep 100',
tags: ['webide'], tags: ['webide'],
image: 'ruby:3.0', image: 'image:1.0',
services: ['mysql'], services: ['mysql'],
variables: { KEY: 'value' } } variables: { KEY: 'value' } }
end end
...@@ -143,7 +143,7 @@ RSpec.describe Gitlab::WebIde::Config::Entry::Terminal do ...@@ -143,7 +143,7 @@ RSpec.describe Gitlab::WebIde::Config::Entry::Terminal do
tag_list: ['webide'], tag_list: ['webide'],
job_variables: [{ key: 'KEY', value: 'value', public: true }], job_variables: [{ key: 'KEY', value: 'value', public: true }],
options: { options: {
image: { name: "ruby:3.0" }, image: { name: "image:1.0" },
services: [{ name: "mysql" }], services: [{ name: "mysql" }],
before_script: %w[ls pwd], before_script: %w[ls pwd],
script: ['sleep 100'] script: ['sleep 100']
......
...@@ -11,7 +11,7 @@ RSpec.describe Gitlab::WebIde::Config do ...@@ -11,7 +11,7 @@ RSpec.describe Gitlab::WebIde::Config do
let(:yml) do let(:yml) do
<<-EOS <<-EOS
terminal: terminal:
image: ruby:2.7 image: image:1.0
before_script: before_script:
- gem install rspec - gem install rspec
EOS EOS
...@@ -21,7 +21,7 @@ RSpec.describe Gitlab::WebIde::Config do ...@@ -21,7 +21,7 @@ RSpec.describe Gitlab::WebIde::Config do
it 'returns hash created from string' do it 'returns hash created from string' do
hash = { hash = {
terminal: { terminal: {
image: 'ruby:2.7', image: 'image:1.0',
before_script: ['gem install rspec'] before_script: ['gem install rspec']
} }
} }
......
...@@ -2224,7 +2224,7 @@ RSpec.describe Ci::Build do ...@@ -2224,7 +2224,7 @@ RSpec.describe Ci::Build do
describe '#options' do describe '#options' do
let(:options) do let(:options) do
{ {
image: "ruby:2.7", image: "image:1.0",
services: ["postgres"], services: ["postgres"],
script: ["ls -a"] script: ["ls -a"]
} }
...@@ -2235,7 +2235,7 @@ RSpec.describe Ci::Build do ...@@ -2235,7 +2235,7 @@ RSpec.describe Ci::Build do
end end
it 'allows to access with symbolized keys' do it 'allows to access with symbolized keys' do
expect(build.options[:image]).to eq('ruby:2.7') expect(build.options[:image]).to eq('image:1.0')
end end
it 'rejects access with string keys' do it 'rejects access with string keys' do
......
...@@ -41,7 +41,7 @@ RSpec.describe WebIdeTerminal do ...@@ -41,7 +41,7 @@ RSpec.describe WebIdeTerminal do
context 'when image does not have an alias' do context 'when image does not have an alias' do
let(:config) do let(:config) do
{ image: 'ruby:2.7' }.merge(services_with_aliases) { image: 'image:1.0' }.merge(services_with_aliases)
end end
it 'returns services aliases' do it 'returns services aliases' do
...@@ -51,7 +51,7 @@ RSpec.describe WebIdeTerminal do ...@@ -51,7 +51,7 @@ RSpec.describe WebIdeTerminal do
context 'when both image and services have aliases' do context 'when both image and services have aliases' do
let(:config) do let(:config) do
{ image: { name: 'ruby:2.7', alias: 'ruby' } }.merge(services_with_aliases) { image: { name: 'image:1.0', alias: 'ruby' } }.merge(services_with_aliases)
end end
it 'returns all aliases' do it 'returns all aliases' do
...@@ -61,7 +61,7 @@ RSpec.describe WebIdeTerminal do ...@@ -61,7 +61,7 @@ RSpec.describe WebIdeTerminal do
context 'when image and services does not have any alias' do context 'when image and services does not have any alias' do
let(:config) do let(:config) do
{ image: 'ruby:2.7', services: ['postgres'] } { image: 'image:1.0', services: ['postgres'] }
end end
it 'returns an empty array' do it 'returns an empty array' do
......
...@@ -216,7 +216,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do ...@@ -216,7 +216,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
expect(json_response['token']).to eq(job.token) expect(json_response['token']).to eq(job.token)
expect(json_response['job_info']).to eq(expected_job_info) expect(json_response['job_info']).to eq(expected_job_info)
expect(json_response['git_info']).to eq(expected_git_info) expect(json_response['git_info']).to eq(expected_git_info)
expect(json_response['image']).to eq({ 'name' => 'ruby:2.7', 'entrypoint' => '/bin/sh', 'ports' => [] }) expect(json_response['image']).to eq({ 'name' => 'image:1.0', 'entrypoint' => '/bin/sh', 'ports' => [] })
expect(json_response['services']).to eq([{ 'name' => 'postgres', 'entrypoint' => nil, expect(json_response['services']).to eq([{ 'name' => 'postgres', 'entrypoint' => nil,
'alias' => nil, 'command' => nil, 'ports' => [], 'variables' => nil }, 'alias' => nil, 'command' => nil, 'ports' => [], 'variables' => nil },
{ 'name' => 'docker:stable-dind', 'entrypoint' => '/bin/sh', { 'name' => 'docker:stable-dind', 'entrypoint' => '/bin/sh',
......
...@@ -195,7 +195,7 @@ RSpec.describe API::Lint do ...@@ -195,7 +195,7 @@ RSpec.describe API::Lint do
end end
context 'with invalid configuration' do context 'with invalid configuration' do
let(:yaml_content) { '{ image: "ruby:2.7", services: ["postgres"] }' } let(:yaml_content) { '{ image: "image:1.0", services: ["postgres"] }' }
it 'responds with errors about invalid configuration' do it 'responds with errors about invalid configuration' do
post api('/ci/lint', api_user), params: { content: yaml_content } post api('/ci/lint', api_user), params: { content: yaml_content }
...@@ -465,7 +465,7 @@ RSpec.describe API::Lint do ...@@ -465,7 +465,7 @@ RSpec.describe API::Lint do
context 'with invalid .gitlab-ci.yml content' do context 'with invalid .gitlab-ci.yml content' do
let(:yaml_content) do let(:yaml_content) do
{ image: 'ruby:2.7', services: ['postgres'] }.deep_stringify_keys.to_yaml { image: 'image:1.0', services: ['postgres'] }.deep_stringify_keys.to_yaml
end end
before do before do
...@@ -712,7 +712,7 @@ RSpec.describe API::Lint do ...@@ -712,7 +712,7 @@ RSpec.describe API::Lint do
context 'with invalid .gitlab-ci.yml content' do context 'with invalid .gitlab-ci.yml content' do
let(:yaml_content) do let(:yaml_content) do
{ image: 'ruby:2.7', services: ['postgres'] }.deep_stringify_keys.to_yaml { image: 'image:1.0', services: ['postgres'] }.deep_stringify_keys.to_yaml
end end
context 'when running as dry run' do context 'when running as dry run' do
......
...@@ -526,7 +526,7 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -526,7 +526,7 @@ RSpec.describe Ci::CreatePipelineService do
let(:ci_yaml) do let(:ci_yaml) do
<<-EOS <<-EOS
image: image:
name: ruby:2.7 name: image:1.0
ports: ports:
- 80 - 80
EOS EOS
...@@ -538,12 +538,12 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -538,12 +538,12 @@ RSpec.describe Ci::CreatePipelineService do
context 'in the job image' do context 'in the job image' do
let(:ci_yaml) do let(:ci_yaml) do
<<-EOS <<-EOS
image: ruby:2.7 image: image:1.0
test: test:
script: rspec script: rspec
image: image:
name: ruby:2.7 name: image:1.0
ports: ports:
- 80 - 80
EOS EOS
...@@ -555,11 +555,11 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -555,11 +555,11 @@ RSpec.describe Ci::CreatePipelineService do
context 'in the service' do context 'in the service' do
let(:ci_yaml) do let(:ci_yaml) do
<<-EOS <<-EOS
image: ruby:2.7 image: image:1.0
test: test:
script: rspec script: rspec
image: ruby:2.7 image: image:1.0
services: services:
- name: test - name: test
ports: ports:
......
...@@ -60,7 +60,7 @@ RSpec.describe Ci::CreateWebIdeTerminalService do ...@@ -60,7 +60,7 @@ RSpec.describe Ci::CreateWebIdeTerminalService do
<<-EOS <<-EOS
terminal: terminal:
image: image:
name: ruby:2.7 name: image:1.0
ports: ports:
- 80 - 80
script: rspec script: rspec
......
image: ruby:2.6 image: image:1.0
services: services:
- postgres - postgres
......
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