Commit 8a174110 authored by Roy Zwambag's avatar Roy Zwambag Committed by Aleksei Lipniagov

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

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