Skip to content
Snippets Groups Projects
Commit d63f1e94 authored by Marius Bobin's avatar Marius Bobin :two:
Browse files

Merge branch '339192-as-ignore-rule-for-builds-token' into 'master'

Ignore token column from ci_builds table

See merge request !91047
parents f82e4b43 8ad5c503
No related branches found
No related tags found
1 merge request!91047Ignore token column from ci_builds table
Pipeline #577832497 passed with warnings
Pipeline: GitLab

#577861886

    ......@@ -8,9 +8,12 @@ class CommitStatus < Ci::ApplicationRecord
    include EnumWithNil
    include BulkInsertableAssociations
    include TaggableQueries
    include IgnorableColumns
    self.table_name = 'ci_builds'
    ignore_column :token, remove_with: '15.4', remove_after: '2022-08-22'
    belongs_to :user
    belongs_to :project
    belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :commit_id
    ......
    ......@@ -52,7 +52,7 @@ def kubernetes_variables(environment:, job:)
    # https://gitlab.com/groups/gitlab-org/configure/-/epics/8
    # Until then, we need to make both the old and the new KUBECONFIG contexts available
    collection.concat(deployment_variables(environment: environment, job: job))
    template = ::Ci::GenerateKubeconfigService.new(pipeline, token: job.token).execute
    template = ::Ci::GenerateKubeconfigService.new(pipeline, token: job.try(:token)).execute
    kubeconfig_yaml = collection['KUBECONFIG']&.value
    template.merge_yaml(kubeconfig_yaml) if kubeconfig_yaml.present?
    ......
    ......@@ -441,7 +441,7 @@ def match_mr1_note(content_regex)
    end
    it 'has a new CI build token' do
    expect(Ci::Build.where(token: 'abcd')).to be_empty
    expect(Ci::Build.find_by_token('abcd')).to be_nil
    end
    end
    ......@@ -568,20 +568,10 @@ def match_mr1_note(content_regex)
    context 'when there is an existing build with build token' do
    before do
    create(:ci_build, token: 'abcd')
    end
    it_behaves_like 'restores project successfully',
    issues: 1,
    labels: 2,
    label_with_priorities: 'A project label',
    milestones: 1,
    first_issue_labels: 1
    end
    context 'when there is an existing build with build token' do
    before do
    create(:ci_build, token: 'abcd')
    create(:ci_build).tap do |job|
    job.set_token('abcd')
    job.save!
    end
    end
    it_behaves_like 'restores project successfully',
    ......
    ......@@ -2598,7 +2598,7 @@
    context 'when token is empty' do
    before do
    build.update_columns(token: nil, token_encrypted: nil)
    build.update_columns(token_encrypted: nil)
    end
    it { is_expected.to be_nil}
    ......
    ......@@ -57,7 +57,7 @@
    let(:clone_accessors) { ::Ci::Build.clone_accessors.without(::Ci::Build.extra_accessors) }
    let(:reject_accessors) do
    %i[id status user token token_encrypted coverage trace runner
    %i[id status user token_encrypted coverage trace runner
    artifacts_expire_at
    created_at updated_at started_at finished_at queued_at erased_by
    erased_at auto_canceled_by job_artifacts job_artifacts_archive
    ......
    ......@@ -546,7 +546,7 @@
    let!(:job) { create(:ci_build, :pending, :queued, :tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) }
    let!(:job2) { create(:ci_build, :pending, :queued, :tag, pipeline: pipeline, name: 'rubocop', stage: 'test', stage_idx: 0) }
    let!(:test_job) do
    create(:ci_build, :pending, :queued, pipeline: pipeline, token: 'test-job-token', name: 'deploy',
    create(:ci_build, :pending, :queued, pipeline: pipeline, name: 'deploy',
    stage: 'deploy', stage_idx: 1,
    options: { script: ['bash'], dependencies: [job2.name] })
    end
    ......@@ -570,7 +570,7 @@
    let!(:job) { create(:ci_build, :pending, :queued, :tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) }
    let!(:job2) { create(:ci_build, :pending, :queued, :tag, pipeline: pipeline, name: 'rubocop', stage: 'test', stage_idx: 0) }
    let!(:empty_dependencies_job) do
    create(:ci_build, :pending, :queued, pipeline: pipeline, token: 'test-job-token', name: 'empty_dependencies_job',
    create(:ci_build, :pending, :queued, pipeline: pipeline, name: 'empty_dependencies_job',
    stage: 'deploy', stage_idx: 1,
    options: { script: ['bash'], dependencies: [] })
    end
    ......@@ -897,7 +897,7 @@
    describe 'a job with excluded artifacts' do
    context 'when excluded paths are defined' do
    let(:job) do
    create(:ci_build, :pending, :queued, pipeline: pipeline, token: 'test-job-token', name: 'test',
    create(:ci_build, :pending, :queued, pipeline: pipeline, name: 'test',
    stage: 'deploy', stage_idx: 1,
    options: { artifacts: { paths: ['abc'], exclude: ['cde'] } })
    end
    ......
    ......@@ -265,10 +265,9 @@
    end
    context 'build token' do
    let(:token) { 'my_secret_token' }
    let(:token) { build.token }
    before do
    build.update!(token: token)
    trace.append(token, 0)
    end
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment