Commit 734dd474 authored by Marius Bobin's avatar Marius Bobin Committed by Mayra Cabrera

Use static status check name on GitHub integration

default GitHubService#static_context to true for new integrations
parent b6311d52
......@@ -30,19 +30,18 @@ with `repo:status` access granted:
1. Select the "Active" checkbox.
1. Paste the token you've generated on GitHub
1. Enter the path to your project on GitHub, such as `https://github.com/username/repository`
1. Optionally check "Static status check names" checkbox to enable static status check names.
1. Optionally uncheck **Static status check names** checkbox to disable static status check names.
1. Save or optionally click "Test Settings".
#### Static / dynamic status check names
Since GitLab 11.5 it is possible to opt-in to using static status check names.
> - Introduced in GitLab 11.5: using static status check names as opt-in option.
> - [In GitLab 12.4](https://gitlab.com/gitlab-org/gitlab-ee/issues/9931), static status check names is default behavior for new projects.
This makes it possible to mark these status checks as _Required_ on GitHub.
If you check "Static status check names" checkbox on the integration page, your
With **Static status check names** enabled on the integration page, your
GitLab instance host name is going to be appended to a status check name,
whereas in case of dynamic status check names, a branch name is going to be
appended.
Dynamic status check name is a default behavior.
![Configure GitHub Project Integration](img/github_configuration.png)
......@@ -14,6 +14,10 @@ class GithubService < Service
default_value_for :pipeline_events, true
def initialize_properties
self.properties ||= { static_context: true }
end
def title
'GitHub'
end
......
......@@ -35,7 +35,8 @@ module CiCd
{
active: true,
repository_url: repository_url,
token: github_access_token
token: github_access_token,
static_context: true
}
end
......
---
title: Use static status check names on GitHub integrations
merge_request: 15737
author:
type: changed
......@@ -76,6 +76,58 @@ describe GithubService do
end
end
describe '#properties' do
let(:properties) { subject.reload.properties.symbolize_keys }
it 'does not overwrite existing integrations' do
subject.update(service_params.slice(:properties))
expect(properties).to match(service_params[:properties])
expect(subject.static_context).to be_nil
end
context 'when initialized without properties' do
let(:service_params) do
{
active: false,
project: project
}
end
it 'static_context defaults to true' do
expect(properties).to match(static_context: true)
end
end
context 'when initialized with static_context as false' do
let(:service_params) do
{
active: false,
project: project,
static_context: false
}
end
it 'static_context remains false' do
expect(properties).to match(static_context: false)
end
end
context 'when initialized with static_context as false' do
let(:service_params) do
{
active: false,
project: project,
properties: { static_context: false }
}
end
it 'static_context remains false' do
expect(properties).to match(static_context: false)
end
end
end
describe '#execute' do
let(:remote_repo_path) { "#{owner}/#{repository_name}" }
let(:sha) { pipeline.sha }
......
......@@ -27,5 +27,9 @@ describe CiCd::GithubIntegrationSetupService do
specify 'with repo URL' do
expect(integration.repository_url).to eq 'https://github.com/MyUser/my-project'
end
specify 'with static_context' do
expect(integration.static_context).to eq true
end
end
end
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