Skip to content

Commit

Permalink
Merge tag 'gitlab-plugin-1.6.0' into gebit
Browse files Browse the repository at this point in the history
[maven-release-plugin] copy for tag gitlab-plugin-1.6.0
  • Loading branch information
gebinic committed Nov 28, 2022
2 parents 8be4559 + 025b549 commit e7ca7b0
Show file tree
Hide file tree
Showing 16 changed files with 433 additions and 98 deletions.
12 changes: 12 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
tasks:
- init: mvn clean verify

vscode:
extensions:
- bierner.markdown-preview-github-styles
- vscjava.vscode-java-pack
- redhat.java
- vscjava.vscode-java-debug
- vscjava.vscode-java-dependency
- vscjava.vscode-java-test
- vscjava.vscode-maven
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.3</version>
<version>1.4</version>
</extension>
</extensions>
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Contributing to the Plugin

Plugin source code is hosted on [GitHub](https://github.com/jenkinsci/gitlab-plugin).
New feature proposals and bug fix proposals should be submitted as
[GitHub pull requests](https://help.github.com/articles/creating-a-pull-request).
Fork the repository on GitHub, prepare your change on your forked
copy, and submit a pull request (see [here](https://github.com/jenkinsci/gitlab-plugin/pulls) for open pull requests). Your pull request will be evaluated by the [plugin's CI job](https://ci.jenkins.io/blue/organizations/jenkins/Plugins%2Fgitlab-plugin/).

If you are adding new features please make sure that they support Jenkins Pipeline jobs.
See [here](https://github.com/jenkinsci/workflow-plugin/blob/master/COMPATIBILITY.md) for some information.


Before submitting your change make sure that:
* your changes work with the oldest and latest supported GitLab version
* new features are provided with tests
* refactored code is provided with regression tests
* the code formatting follows the plugin standard
* imports are organised
* you updated the help docs
* you updated the README
* you have used spotbugs to see if you haven't introduced any new warnings

## Testing With Docker

See https://github.com/jenkinsci/gitlab-plugin/tree/master/src/docker/README.md

## Release Workflow

To perform a full plugin release, maintainers can run ``mvn release:prepare release:perform`` To release a snapshot, e.g. with a bug fix for users to test, just run ``mvn deploy``

9 changes: 8 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@
* See the documentation for more options:
* https://github.com/jenkins-infra/pipeline-library/
*/
buildPlugin(useContainerAgent: true)
buildPlugin(useContainerAgent: true,
configurations: [
[platform: 'linux', jdk: '17', jenkins: '2.375'],
[platform: 'linux', jdk: '11', jenkins: '2.361.3'],
[platform: 'windows', jdk: '8']
]

)
45 changes: 13 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ This is not an exhaustive list of issues, but rather a place for us to note sign
* [#608](https://github.com/jenkinsci/gitlab-plugin/issues/608) - GitLab 9.5.0 - 9.5.4 has a bug that causes the "Test Webhook" function to fail when it sends a test to Jenkins. This was fixed in 9.5.5.
* [#730](https://github.com/jenkinsci/gitlab-plugin/issues/730) - GitLab 10.5.6 introduced an issue which can cause HTTP 500 errors when webhooks are triggered if the webhook is pointing to http://localhost or http://127.0.0.1. See the linked issue for a workaround.

## Report an Issue

Please report issues and enhancements through the [GitHub issue tracker](https://github.com/jenkinsci/gitlab-plugin/issues/new/choose).

## Defined variables

When GitLab triggers a build via the plugin, various environment variables are set based on the JSON payload that GitLab sends. You can use these throughout your job configuration. The available variables are:
Expand Down Expand Up @@ -345,7 +349,7 @@ Also make sure you have chosen the appropriate GitLab instance from the 'GitLab
}
}
```
* Or use the `updateGitlabCommitStatus` step to use a custom value for updating the commit status. You could use try/catch blocks or other logic to send fine-grained status of the build to GitLab. Valid statuses are defined by GitLab and documented here: https://docs.gitlab.com/ce/api/pipelines.html
* Or use the `updateGitlabCommitStatus` step to use a custom value for updating the commit status. You could use try/catch blocks or other logic to send fine-grained status of the build to GitLab. Valid statuses are defined by GitLab and documented here: https://docs.gitlab.com/ee/api/commits.html#post-the-build-status-to-a-commit
```groovy
node() {
stage('Checkout') { checkout <your-scm-config> }
Expand Down Expand Up @@ -393,6 +397,9 @@ pipeline {
success {
updateGitlabCommitStatus name: 'build', state: 'success'
}
aborted {
updateGitlabCommitStatus name: 'build', state: 'canceled'
}
}
options {
gitLabConnection('your-gitlab-connection-name')
Expand All @@ -403,6 +410,7 @@ pipeline {
stages {
stage("build") {
steps {
updateGitlabCommitStatus name: 'build', state: 'running'
echo "hello world"
}
}
Expand Down Expand Up @@ -559,41 +567,14 @@ This saves time in projects where builds can stay long time in a build queue and

Version 1.2.1 of the plugin introduces a backwards-incompatible change
for Pipeline jobs. They will need to be manually reconfigured when you
upgrade to this version. Freestyle jobs are not impacted. Please see the
README for details.

upgrade to this version. Freestyle jobs are not impacted.

## Contributing to the Plugin

Plugin source code is hosted on [GitHub](https://github.com/jenkinsci/gitlab-plugin).
New feature proposals and bug fix proposals should be submitted as
[GitHub pull requests](https://help.github.com/articles/creating-a-pull-request).
Fork the repository on GitHub, prepare your change on your forked
copy, and submit a pull request (see [here](https://github.com/jenkinsci/gitlab-plugin/pulls) for open pull requests). Your pull request will be evaluated by the [plugin's CI job](https://ci.jenkins.io/blue/organizations/jenkins/Plugins%2Fgitlab-plugin/).

If you are adding new features please make sure that they support Jenkins Pipeline jobs.
See [here](https://github.com/jenkinsci/workflow-plugin/blob/master/COMPATIBILITY.md) for some information.


Before submitting your change make sure that:
* your changes work with the oldest and latest supported GitLab version
* new features are provided with tests
* refactored code is provided with regression tests
* the code formatting follows the plugin standard
* imports are organised
* you updated the help docs
* you updated the README
* you have used findbugs to see if you haven't introduced any new warnings

## Testing With Docker

See https://github.com/jenkinsci/gitlab-plugin/tree/master/src/docker/README.md 🙂

## Release Workflow

To perform a full plugin release, maintainers can run ``mvn release:prepare release:perform`` To release a snapshot, e.g. with a bug fix for users to test, just run ``mvn deploy``
Detailed instructions for code and documentation contributions to the plugin are available in the [contributing guide](CONTRIBUTING.md).

## Changelog

For recent versions, see [GitHub Releases](https://github.com/jenkinsci/gitlab-plugin/releases).

For versions 1.5.14 and older, see [CHANGELOG.md](CHANGELOG.md).
For versions 1.5.21 and older, see the [historical changelog](https://github.com/jenkinsci/gitlab-plugin/blob/gitlab-plugin-1.5.34/CHANGELOG.md).
49 changes: 24 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.40</version>
<version>4.50</version>
<relativePath />
</parent>
<artifactId>gitlab-plugin</artifactId>
<version>1.5.35</version>
<version>1.6.0</version>
<name>GitLab Plugin</name>
<url>https://github.com/jenkinsci/${project.artifactId}</url>
<packaging>hpi</packaging>

<properties>
<revision>1.5.35</revision>
<revision>1.6.0</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.289.3</jenkins.version>
<spotbugs.threshold>High</spotbugs.threshold> <!-- TODO fix violations -->
<jenkins.version>2.346.3</jenkins.version>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
<gitHubRepo>jenkinsci/${project.artifactId}</gitHubRepo>
<hpi.compatibleSinceVersion>1.4.0</hpi.compatibleSinceVersion>
<mockserver.version>5.13.0</mockserver.version>
<mockserver.version>5.14.0</mockserver.version>
</properties>


Expand Down Expand Up @@ -56,7 +57,7 @@
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:[email protected]:${gitHubRepo}.git</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
<tag>gitlab-plugin-1.5.35</tag>
<tag>gitlab-plugin-1.6.0</tag>
</scm>
<!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->
<repositories>
Expand Down Expand Up @@ -141,11 +142,6 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>display-url-api</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>


<!-- REST client dependencies -->
Expand Down Expand Up @@ -242,6 +238,10 @@
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
</exclusion>
<exclusion>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -276,8 +276,15 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.4.0</version>
<version>42.5.0</version>
<scope>test</scope>
<exclusions>
<!-- Upper bounds with Guava -->
<exclusion>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -304,21 +311,15 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<!-- Pick up common dependencies for the selected LTS line: https://github.com/jenkinsci/bom#usage -->
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.289.x</artifactId>
<version>1438.v6a_2c29d73f82</version>
<artifactId>bom-2.346.x</artifactId>
<version>1678.vc1feb_6a_3c0f1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -330,7 +331,7 @@
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.14</version>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
Expand All @@ -340,12 +341,10 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down Expand Up @@ -445,7 +444,7 @@
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.40.1</version>
<version>0.40.2</version>
<configuration>
<verbose>true</verbose>
<images>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,9 @@ protected Object readResolve() throws ObjectStreamException {
public static GitLabPushTrigger getFromJob(Job<?, ?> job) {
GitLabPushTrigger trigger = null;
if (job instanceof ParameterizedJobMixIn.ParameterizedJob) {
ParameterizedJobMixIn.ParameterizedJob p = (ParameterizedJobMixIn.ParameterizedJob) job;
Collection<Trigger> triggerList = p.getTriggers().values();
for (Trigger t : triggerList) {
ParameterizedJobMixIn.ParameterizedJob<?, ?> p = (ParameterizedJobMixIn.ParameterizedJob) job;
Collection<Trigger<?>> triggerList = p.getTriggers().values();
for (Trigger<?> t : triggerList) {
if (t instanceof GitLabPushTrigger) {
trigger = (GitLabPushTrigger) t;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import javax.ws.rs.ProcessingException;
import javax.ws.rs.WebApplicationException;

import org.antlr.v4.runtime.misc.NotNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
Expand Down Expand Up @@ -84,7 +84,7 @@ public GitLabClient getClient() {
return null;
}

public static GitLabClient getClient(@NotNull Run<?, ?> build) {
public static GitLabClient getClient(@NonNull Run<?, ?> build) {
Job<?, ?> job = build.getParent();
if (job != null) {
final GitLabConnectionProperty connectionProperty = job.getProperty(GitLabConnectionProperty.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected void perform(Run<?, ?> build, TaskListener listener, GitLabClient clie
client.awardMergeRequestEmoji(mergeRequest, getResultIcon(build.getResult()));
}
} catch (NotFoundException e) {
String message = String.format("Failed to add vote on Merge Request for project '%s'\n" +
String message = String.format("Failed to add vote on Merge Request for project '%s'%n" +
"Got unexpected 404, are you using the wrong API version or trying to vote on your own merge request?", mergeRequest.getProjectId());
listener.getLogger().println(message);
LOGGER.log(Level.WARNING, message, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected CauseData retrieveCauseData(PipelineHook hook) {
.withRef(hook.getObjectAttributes().getRef()==null?"":hook.getObjectAttributes().getRef())
.withSha(hook.getObjectAttributes().getSha()==null?"":hook.getObjectAttributes().getSha())
.withBeforeSha(hook.getObjectAttributes().getBeforeSha()==null?"":hook.getObjectAttributes().getBeforeSha())
.withStatus(hook.getObjectAttributes().getStatus()==null?"":hook.getObjectAttributes().getStatus().toString())
.withStatus(hook.getObjectAttributes().getStatus()==null?"":hook.getObjectAttributes().getStatus())
.withStages(hook.getObjectAttributes().getStages()==null?"":hook.getObjectAttributes().getStages().toString())
.withCreatedAt(hook.getObjectAttributes().getCreatedAt()==null?"":hook.getObjectAttributes().getCreatedAt().toString())
.withFinishedAt(hook.getObjectAttributes().getFinishedAt()==null?"":hook.getObjectAttributes().getFinishedAt().toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class OpenMergeRequestPushHookTriggerHandler implements PushHookTriggerHandler {
public void handle(Job<?, ?> job, PushHook hook, boolean ciSkip, BranchFilter branchFilter, MergeRequestLabelFilter mergeRequestLabelFilter) {
try {
if (job instanceof ParameterizedJobMixIn.ParameterizedJob) {
ParameterizedJob project = (ParameterizedJobMixIn.ParameterizedJob) job;
ParameterizedJob<?, ?> project = (ParameterizedJobMixIn.ParameterizedJob) job;
GitLabConnectionProperty property = job.getProperty(GitLabConnectionProperty.class);
Collection<Trigger> triggerList = project.getTriggers().values();
for (Trigger t : triggerList) {
Collection<Trigger<?>> triggerList = project.getTriggers().values();
for (Trigger<?> t : triggerList) {
if (t instanceof GitLabPushTrigger) {
final GitLabPushTrigger trigger = (GitLabPushTrigger) t;
Integer projectId = hook.getProjectId();
Expand Down
Loading

0 comments on commit e7ca7b0

Please sign in to comment.