Skip to content

Commit

Permalink
Merge branch 'master' into String_feature_update
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSaini101 authored Jun 1, 2024
2 parents 9504e80 + d0c5f36 commit 639c99c
Show file tree
Hide file tree
Showing 19 changed files with 146 additions and 107 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @jenkinsci/run-condition-plugin-developers
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates
---
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
labels:
- "dependencies"
schedule:
interval: "monthly"
- package-ecosystem: "github-actions"
directory: "/"
labels:
- "skip-changelog"
schedule:
interval: "monthly"
2 changes: 0 additions & 2 deletions .github/release-drafter.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Note: additional setup is required, see https://www.jenkins.io/redirect/continuous-delivery-of-plugins

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

permissions:
checks: read
contents: write

jobs:
maven-cd:
uses: jenkins-infra/github-reusable-workflows/.github/workflows/maven-cd.yml@v1
secrets:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/jenkins-security-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Jenkins Security Scan
# For more information, see: https://www.jenkins.io/doc/developer/security/scan/

name: Jenkins Security Scan

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

permissions:
security-events: write
contents: read
actions: read

jobs:
security-scan:
uses: jenkins-infra/jenkins-security-scan/.github/workflows/jenkins-security-scan.yaml@v2
with:
java-cache: 'maven'
java-version: 11
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.1</version>
<version>1.8</version>
</extension>
</extensions>
3 changes: 2 additions & 1 deletion .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-Pconsume-incrementals
-Pmight-produce-incrementals
-Pmight-produce-incrementals
-Dchangelist.format=%d.v%s
14 changes: 10 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env groovy

/* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */
buildPlugin()
/*
See the documentation for more options:
https://github.com/jenkins-infra/pipeline-library/
*/
buildPlugin(
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
configurations: [
[platform: 'linux', jdk: 21],
[platform: 'windows', jdk: 17],
])
57 changes: 10 additions & 47 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,21 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.48</version>
<version>4.82</version>
</parent>

<artifactId>run-condition</artifactId>
<packaging>hpi</packaging>
<name>Run Condition Plugin</name>
<version>${revision}${changelist}</version>
<version>${changelist}</version>
<url>https://github.com/jenkinsci/run-condition-plugin</url>

<properties>
<revision>1.6</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.346.3</jenkins.version>
<revision>1.8</revision>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.387.3</jenkins.version>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
</properties>

<licenses>
Expand All @@ -63,8 +65,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.346.x</artifactId>
<version>1607.va_c1576527071</version>
<artifactId>bom-2.387.x</artifactId>
<version>2543.vfb_1a_5fb_9496d</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -79,20 +81,13 @@
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>4.2</version>
<version>5.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>conditional-buildstep</artifactId>
<version>1.4.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down Expand Up @@ -144,36 +139,4 @@
</pluginRepository>
</pluginRepositories>

<build>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<versionRange>[1.0-rc-5,)</versionRange>
<goals>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
16 changes: 0 additions & 16 deletions src/main/resources/lib/runConditionPlugin/blockWrapper.jelly

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
~ THE SOFTWARE.
-->

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler" xmlns:cond="/lib/runConditionPlugin">
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler">

<f:entry>
<j:scope>
<j:set var="items" value="${instance.days ?: descriptor.defaultDays}"/>
<j:set var="descriptor" value="${descriptor.dayDescriptor}"/>
<f:repeatable items="${items}" var="instance" name="days" header="" noAddButton="true">
<cond:blockWrapper>
<div>
<st:include page="config.jelly" class="${descriptor.clazz}"/>
</cond:blockWrapper>
</div>
</f:repeatable>
</j:scope>
</f:entry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@
~ THE SOFTWARE.
-->

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler" xmlns:cond="/lib/runConditionPlugin">
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler">

<f:entry>
<j:scope>
<j:set var="logicSymbol" value="&amp;&amp;"/>
<j:set var="descriptor" value="${descriptor.getPropertyType(instance,'conditions').itemTypeDescriptor}"/>
<f:repeatable items="${instance.conditions}" var="instance" name="conditions" minimum="2" add="${%add}">
<cond:blockWrapper>
<div>
<st:include page="config.jelly" class="${descriptor.clazz}"/>
<f:entry title="">
<div align="right" class="show-if-not-only">
<f:repeatableDeleteButton value="${%delete}"/>
</div>
</f:entry>
</cond:blockWrapper>
</div>
</f:repeatable>
</j:scope>
</f:entry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@
~ THE SOFTWARE.
-->

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler" xmlns:cond="/lib/runConditionPlugin">
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler">

<f:entry>
<j:scope>
<j:set var="logicSymbol" value="||"/>
<j:set var="descriptor" value="${descriptor.getPropertyType(instance,'conditions').itemTypeDescriptor}"/>
<f:repeatable items="${instance.conditions}" var="instance" name="conditions" minimum="2" add="${%add}">
<cond:blockWrapper>
<div>
<st:include page="config.jelly" class="${descriptor.clazz}"/>
<f:entry title="">
<div align="right" class="show-if-not-only">
<f:repeatableDeleteButton value="${%delete}"/>
</div>
</f:entry>
</cond:blockWrapper>
</div>
</f:repeatable>
</j:scope>
</f:entry>
Expand Down
27 changes: 27 additions & 0 deletions src/spotbugs/excludesFilter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<FindBugsFilter>
<!--
Exclusions in this section have been triaged and determined to be false positives.
-->

<Match>
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/>
<Class name="org.jenkins_ci.plugins.run_condition.BuildStepRunner"/>
</Match>

<Match>
<Bug pattern="SE_NO_SERIALVERSIONID"/>
<Class name="jenkins.plugins.http_request.auth.CertificateAuthentication"/>
</Match>

<Match>
<Bug pattern="DM_CONVERT_CASE"/>
<Class name="org.jenkins_ci.plugins.run_condition.core.BooleanCondition"/>
<Method name="runPerform"/>
</Match>

<Match>
<Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
<Class name="org.jenkins_ci.plugins.run_condition.core.NodeCondition$NodeNameComparator"/>
</Match>

</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@
public class CauseConditionTest {

public @Rule
JenkinsRule j = new JenkinsRule();
JenkinsRule jenkinsRule = new JenkinsRule();

@Before
public void setupDummySecurity() {
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
jenkinsRule.jenkins.setSecurityRealm(jenkinsRule.createDummySecurityRealm());
}

//-------------------------------------------------------
Expand Down Expand Up @@ -147,7 +147,7 @@ public void testUCAnyUser() throws Exception {
public void testMatrixUpstreamCause() throws Exception {

// setup some Causes
FreeStyleProject upProject = j.createFreeStyleProject("firstProject");
FreeStyleProject upProject = jenkinsRule.createFreeStyleProject("firstProject");
FreeStyleBuild upBuild = upProject.scheduleBuild2(0).get();

Cause upstreamCause = new UpstreamCause(upBuild);
Expand All @@ -170,7 +170,7 @@ public void testMatrixUpstreamCause() throws Exception {
public void testMatrixUserCause() throws Exception {

// setup some Causes
FreeStyleProject upProject = j.createFreeStyleProject("secondProject");
FreeStyleProject upProject = jenkinsRule.createFreeStyleProject("secondProject");
FreeStyleBuild upBuild = upProject.scheduleBuild2(0).get();

Cause upstreamCause = new UpstreamCause(upBuild);
Expand Down Expand Up @@ -203,13 +203,13 @@ private void runMatrixTest(Cause buildTrigger, RunCondition condition, Boolean b
List<MatrixRun> runs = matrixBuild.getRuns();
assertEquals(4,runs.size());
for (MatrixRun run : runs) {
j.assertBuildStatus(testResult, run);
jenkinsRule.assertBuildStatus(testResult, run);
}

}

private MatrixProject createMatrixProject() throws IOException {
MatrixProject p = j.createProject(MatrixProject.class);
MatrixProject p = jenkinsRule.createProject(MatrixProject.class);

// set up 2x2 matrix
AxisList axes = new AxisList();
Expand All @@ -221,7 +221,7 @@ private MatrixProject createMatrixProject() throws IOException {
}
private void runtest(List<Cause> causes, RunCondition condition, boolean expected) throws Exception {

FreeStyleProject project = j.createFreeStyleProject();
FreeStyleProject project = jenkinsRule.createFreeStyleProject();
FreeStyleBuild build;

if (causes.size() > 0) {
Expand Down
Loading

0 comments on commit 639c99c

Please sign in to comment.