Skip to content

Commit

Permalink
Refresh plugin (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
timja authored Jan 25, 2022
1 parent 97f2fc1 commit 0daf745
Show file tree
Hide file tree
Showing 19 changed files with 156 additions and 118 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: maven
directory: /
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
2 changes: 0 additions & 2 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
_extends: .github
name-template: v$NEXT_MINOR_VERSION 🌈
tag-template: slack-$NEXT_MINOR_VERSION
59 changes: 59 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Note: additional setup is required, see https://www.jenkins.io/redirect/continuous-delivery-of-plugins

name: cd
on:
workflow_dispatch:
check_run:
types:
- completed

jobs:
validate:
runs-on: ubuntu-latest
outputs:
should_release: ${{ steps.verify-ci-status.outputs.result == 'success' && steps.interesting-categories.outputs.interesting == 'true' }}
steps:
- name: Verify CI status
uses: jenkins-infra/[email protected]
id: verify-ci-status
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
output_result: true

- name: Release Drafter
uses: release-drafter/release-drafter@v5
if: steps.verify-ci-status.outputs.result == 'success'
with:
name: next
tag: next
version: next
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check interesting categories
uses: jenkins-infra/[email protected]
id: interesting-categories
if: steps.verify-ci-status.outputs.result == 'success'
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
runs-on: ubuntu-latest
needs: [validate]
if: needs.validate.outputs.should_release == 'true'
steps:
- name: Check out
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 8
- name: Release
uses: jenkins-infra/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}
16 changes: 0 additions & 16 deletions .github/workflows/release-drafter.yml

This file was deleted.

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.0-beta-7</version>
<version>1.3</version>
</extension>
</extensions>
1 change: 1 addition & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-Pconsume-incrementals
-Pmight-produce-incrementals
-Dchangelist.format=%d.v%s
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ def configurations = [
[ platform: "linux", jdk: "8", jenkins: null ],
[ platform: "linux", jdk: "11", jenkins: null, javaLevel: "8" ]
]
buildPlugin(configurations: configurations, useAci: true)
buildPlugin(configurations: configurations, useContainerAgent: true)
55 changes: 16 additions & 39 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.15</version>
<version>4.33</version>
</parent>

<artifactId>slack</artifactId>
<packaging>hpi</packaging>
<version>${revision}${changelist}</version>
<version>${changelist}</version>
<name>Slack Notification Plugin</name>
<description>A Build status publisher that notifies channels on a Slack team</description>
<url>https://github.com/jenkinsci/slack-plugin</url>

<properties>
<revision>2.50</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.222.4</jenkins.version>
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/slack-plugin</gitHubRepo>
<jenkins.version>2.289.1</jenkins.version>
<hpi.compatibleSinceVersion>2.32</hpi.compatibleSinceVersion>
<java.level>8</java.level>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -36,9 +36,9 @@
</licenses>

<scm>
<connection>scm:git:ssh://git@github.com/jenkinsci/slack-plugin.git</connection>
<developerConnection>scm:git:ssh://git@github.com/jenkinsci/slack-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/slack-plugin</url>
<connection>scm:git:https://github.com/${gitHubRepo}</connection>
<developerConnection>scm:git:https://github.com/${gitHubRepo}</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
<tag>${scmTag}</tag>
</scm>

Expand All @@ -53,8 +53,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.222.x</artifactId>
<version>21</version>
<artifactId>bom-2.289.x</artifactId>
<version>1117.v62a_f6a_01de98</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -66,12 +66,12 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
<version>20211205</version>
</dependency>

<!-- required plugins -->
Expand Down Expand Up @@ -182,28 +182,11 @@
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<artifactId>mockito-inline</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -214,12 +197,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version>
<version>3.1.2</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.29</version>
<version>9.2.1</version>
</dependency>
</dependencies>
</plugin>
Expand Down Expand Up @@ -274,12 +257,6 @@
</pluginRepository>
</pluginRepositories>

<!--
The developers show up as current maintainers in the Jenkins wiki.
https://wiki.jenkins-ci.org/display/JENKINS/Slack+Plugin
The id should be the jenkinsci.org username and not your GitHub username.
-->
<developers>
<developer>
<id>timja</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import com.cloudbees.plugins.credentials.SystemCredentialsProvider;
import com.cloudbees.plugins.credentials.common.StandardCredentials;
import com.cloudbees.plugins.credentials.domains.DomainRequirement;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.security.ACL;
import hudson.util.Secret;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import jenkins.model.Jenkins;
import jenkins.plugins.slack.Messages;
import org.jenkinsci.plugins.plaincredentials.StringCredentials;
Expand All @@ -24,7 +24,7 @@ public class GlobalCredentialMigrator {
private static final Logger LOGGER = Logger.getLogger(GlobalCredentialMigrator.class
.getName());

public StandardCredentials migrate(@Nonnull String token) {
public StandardCredentials migrate(@NonNull String token) {
LOGGER.info("Migrating slack global config: moving integration token text into a credential");

List<StringCredentials> allStringCredentials =
Expand All @@ -44,7 +44,7 @@ public StandardCredentials migrate(@Nonnull String token) {
.orElseGet(() -> addCredentialIfNotPresent(token));
}

private StringCredentials addCredentialIfNotPresent(@Nonnull String token) {
private StringCredentials addCredentialIfNotPresent(@NonNull String token) {
StringCredentials credentials = new StringCredentialsImpl(
CredentialsScope.GLOBAL,
UUID.randomUUID().toString(),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jenkins/plugins/slack/decisions/Context.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package jenkins.plugins.slack.decisions;

import edu.umd.cs.findbugs.annotations.Nullable;
import hudson.model.AbstractBuild;
import hudson.model.Result;
import hudson.tasks.junit.TestResultAction;
import javax.annotation.Nullable;
import jenkins.plugins.slack.logging.BuildKey;

public class Context {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package jenkins.plugins.slack.pipeline;

import com.google.common.collect.ImmutableSet;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.FilePath;
import hudson.Util;
Expand All @@ -12,7 +13,6 @@
import java.io.IOException;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nonnull;
import jenkins.model.Jenkins;
import jenkins.plugins.slack.CredentialsObtainer;
import jenkins.plugins.slack.Messages;
Expand Down Expand Up @@ -90,7 +90,7 @@ public String getFunctionName() {
return "slackUploadFile";
}

@Nonnull
@NonNull
@Override
public String getDisplayName() {
return Messages.slackFileUploadDisplayName();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package jenkins.plugins.slack.pipeline;

import com.google.common.collect.ImmutableSet;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.ProxyConfiguration;
import hudson.Util;
Expand All @@ -13,7 +14,6 @@
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import jenkins.model.Jenkins;
import jenkins.plugins.slack.CredentialsObtainer;
import jenkins.plugins.slack.HttpClient;
Expand Down Expand Up @@ -89,7 +89,7 @@ public String getFunctionName() {
return "slackUserIdFromEmail";
}

@Nonnull
@NonNull
@Override
public String getDisplayName() {
return Messages.slackUserIdFromEmailDisplayName();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package jenkins.plugins.slack.pipeline;

import com.google.common.collect.ImmutableSet;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.ProxyConfiguration;
import hudson.Util;
Expand All @@ -16,7 +17,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import jenkins.model.Jenkins;
import jenkins.plugins.slack.CredentialsObtainer;
import jenkins.plugins.slack.HttpClient;
Expand Down Expand Up @@ -86,7 +86,7 @@ public String getFunctionName() {
return "slackUserIdsFromCommitters";
}

@Nonnull
@NonNull
@Override
public String getDisplayName() {
return Messages.slackUserIdsFromCommittersDisplayName();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package jenkins.plugins.slack.workflow;

import com.google.common.collect.ImmutableSet;
import edu.umd.cs.findbugs.annotations.NonNull;
import groovy.json.JsonOutput;
import hudson.AbortException;
import hudson.Extension;
Expand All @@ -12,7 +13,6 @@
import java.util.Objects;
import java.util.Set;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import jenkins.model.Jenkins;
import jenkins.plugins.slack.CredentialsObtainer;
import jenkins.plugins.slack.Messages;
Expand Down Expand Up @@ -64,7 +64,7 @@ public class SlackSendStep extends Step {
private String username;
private boolean notifyCommitters;

@Nonnull
@NonNull
public String getMessage() {
return message;
}
Expand Down Expand Up @@ -244,7 +244,7 @@ public String getFunctionName() {
return "slackSend";
}

@Nonnull
@NonNull
@Override
public String getDisplayName() {
return Messages.slackSendStepDisplayName();
Expand Down
Loading

0 comments on commit 0daf745

Please sign in to comment.