Git push options to create a merge request, set target_branch and set merge when pipeline succeeds
Closes#53198 and #43263
See merge request gitlab-org/gitlab-ce!26752
Previously the raw push option Array was sent to Pipeline::Chain::Skip.
This commit updates this class (and the chain of classes that pass the
push option parameters from the API internal `post_receive` endpoint to
that class) to treat push options as a Hash of options parsed by
GitLab::PushOptions.
The GitLab::PushOptions class takes options like this:
-o ci.skip -o merge_request.create -o merge_request.target=branch
and turns them into a Hash like this:
{
ci: {
skip: true
},
merge_request: {
create: true,
target: 'branch'
}
}
This now how Pipeline::Chain::Skip is determining if the `ci.skip` push
option was used.
Our templates are free to override the 'stages:'.
However, they should follow the convention to always include
'build', 'test', 'deploy' which are defaults when not defined.
This fix is a followup to !24098 which introduced a validation of the
`include:` keyword of a gitlab-ci configuration file when triggered
from /ci/lint API calls.
However, there was a test case missing: the case of a single string as
value. I have added a test case for that which shows that the code was
not validating it correctly.
This commit fixes that to allow all `include:` valid inputs.
This brings support for untrusted regexp for 'only:refs:' when
enabled via feature flag: alllow_unsafe_ruby_regexp.
This is by default disabled, and should not be used in production
In order to implement https://gitlab.com/gitlab-org/gitlab-ee/issues/10179
we need several modifications on the CI config file. We are
adding a new ports section in the default Image object.
Each of these ports will accept: number, protocol and name.
By default this new configuration will be only enabled in
the Web IDE config file.
Container Scanning, Dependency Scanning, License Management
and SAST parts of Auto DevOps now use the preexisting templates.
Auto DevOps and the DAST job template will now use a
shared job template instead of maintaining two copies
of the job. This also allows Auto DevOps to use custom
authentication with DAST.
This allows these templates to be used outside of Auto DevOps,
or easily excluded from Auto DevOps.
The security jobs in Auto DevOps differ slightly from the ones
that are already available as templates, they will be moved
next.
Create FailedUnmetPrerequisites status to allow custom
messaging for builds that were unable to be queued due
to failing to meet prerequisites (eg. failing to create
Kubernetes namespace for deployment).
For some reason this value can be an empty string and we want to ensure
that we correctly fail the job before a deploy. This is particularly
problematic at the moment when coupled with
https://gitlab.com/gitlab-org/gitlab-ce/issues/54760 as the user has no
easy way to recover without destroying the cluster and starting over.
Instead of creating a Kubernetes namespace on every
cluster related to a project, only create one on the
cluster the project is about to be deployed to.
Builds that have deployments require Kubernetes resources
to be created before the build can be deployed. These
resources are no longer created when the cluster is
created, which allows us to only create the resources
required by each specific build.
Introduces the concept of Prerequisites for a CI build.
If a build has unmet prerequisites it will go through the
:preparing state before being made available to a runner.
There are no actual prerequisites yet, so current
behaviour is unchanged.
Introduces a new status for builds between :created and :pending
that will be used when builds require one or more prerequisite
actions to be completed before being picked up by a runner
(such as creating Kubernetes resources before deploying).
The existing :created > :pending transition is unchanged, so
only builds that require preparation will use the :preparing
status.
This backports the allow_mirror_update update field for Chain::Command
from EE to CE. There's no particular reason to keep this in EE. Doing so
would require refactoring of CE as there currently is no easy way to
inject new Struct members into the Chain::Command class.