Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usages of Prototype #209

Merged
merged 2 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 9 additions & 49 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,13 @@ on:
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/verify-ci-status-action@v1.2.0
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 }}
permissions:
checks: read
contents: write

- name: Check interesting categories
uses: jenkins-infra/interesting-category-action@v1.0.0
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@v3.0.2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v3.3.0
with:
distribution: temurin
java-version: 8
- name: Release
uses: jenkins-infra/jenkins-maven-cd-action@v1.3.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}
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 .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.7</version>
</extension>
</extensions>
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
buildPlugin(configurations: [
[ platform: "linux", jdk: "8", jenkins: null ],
[ platform: "linux", jdk: "11", jenkins: null ]
buildPlugin(useContainerAgent: true, configurations: [
[platform: 'linux', jdk: 17],
[platform: 'windows', jdk: 11],
])
20 changes: 7 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.41</version>
<version>4.71</version>
<relativePath />
</parent>
<groupId>org.jvnet.hudson.plugins</groupId>
Expand All @@ -14,12 +15,11 @@

<properties>
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/chucknorris-plugin</gitHubRepo>
<java.level>8</java.level>
<jenkins.version>2.303.1</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<jenkins.version>2.387.3</jenkins.version>
</properties>

<url>https://github.com/jenkinsci/chucknorris-plugin</url>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
<packaging>hpi</packaging>

<developers>
Expand All @@ -46,8 +46,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.303.x</artifactId>
<version>1451.v15f1fdb_772a_f</version>
<artifactId>bom-2.387.x</artifactId>
<version>2244.vd60654536b_96</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down Expand Up @@ -86,12 +86,6 @@
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
}
</style>
<script>
if($('main-table')) {
$('main-table').setStyle({ backgroundImage: 'none' });
if(document.getElementById('main-table')) {
document.getElementById('main-table').style.backgroundImage = 'none';
}
$('main-panel').addClassName('chuck-style');
document.getElementById('main-panel').classList.add('chuck-style');
</script>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
}
</style>
<script>
if($('main-table')) {
$('main-table').setStyle({ backgroundImage: 'none' });
if(document.getElementById('main-table')) {
document.getElementById('main-table').style.backgroundImage = 'none';
}
$('main-panel').addClassName('chuck-style');
document.getElementById('main-panel').classList.add('chuck-style');
</script>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -9,100 +9,81 @@
import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runners.model.Statement;
import org.jvnet.hudson.test.RestartableJenkinsRule;
import org.jvnet.hudson.test.JenkinsRule;

import hudson.model.Result;
import hudson.plugins.chucknorris.RoundhouseAction;
import hudson.plugins.chucknorris.Style;

public class ChuckNorrisStepTest {
@Rule
public RestartableJenkinsRule story = new RestartableJenkinsRule();
public JenkinsRule j = new JenkinsRule();

@Test
public void badAssChuckNorris() throws Exception {
story.addStep(new Statement() {
@Override
public void evaluate() throws Throwable {
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
WorkflowJob p = j.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition(
"chuckNorris()\n" +
"semaphore 'wait'\n"
));
, true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
SemaphoreStep.waitForStart("wait/1", b1);
SemaphoreStep.failure("wait/1", new Exception());

story.j.waitForCompletion(b1);
story.j.assertBuildStatus(Result.FAILURE, b1);
j.waitForCompletion(b1);
j.assertBuildStatus(Result.FAILURE, b1);

RoundhouseAction action = b1.getAction(RoundhouseAction.class);
assertEquals(Style.BAD_ASS, action.getStyle());
assertNotNull(action.getFact());
}
});
}

@Test
public void alertChuckNorris() throws Exception {
story.addStep(new Statement() {
@Override
public void evaluate() throws Throwable {
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
WorkflowJob p = j.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition(
"chuckNorris()\n" +
"semaphore 'wait'\n"
));
, true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
SemaphoreStep.waitForStart("wait/1", b1);
b1.setResult(Result.UNSTABLE);
SemaphoreStep.success("wait/1", null);

story.j.waitForCompletion(b1);
story.j.assertBuildStatus(Result.UNSTABLE, b1);
j.waitForCompletion(b1);
j.assertBuildStatus(Result.UNSTABLE, b1);

RoundhouseAction action = b1.getAction(RoundhouseAction.class);
assertEquals(Style.ALERT, action.getStyle());
assertNotNull(action.getFact());
}
});
}

@Test
public void thumbsUpChuckNorris() throws Exception {
story.addStep(new Statement() {
@Override
public void evaluate() throws Throwable {
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
WorkflowJob p = j.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition(
"chuckNorris()\n" +
"semaphore 'wait'\n"
));
, true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
SemaphoreStep.waitForStart("wait/1", b1);
SemaphoreStep.success("wait/1", null);

story.j.waitForCompletion(b1);
story.j.assertBuildStatus(Result.SUCCESS, b1);
j.waitForCompletion(b1);
j.assertBuildStatus(Result.SUCCESS, b1);

RoundhouseAction action = b1.getAction(RoundhouseAction.class);
assertEquals(Style.THUMB_UP, action.getStyle());
assertNotNull(action.getFact());
}
});
}

@Test
public void projectPageChuckNorris() throws Exception {
story.addStep(new Statement() {
@Override
public void evaluate() throws Throwable {
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
WorkflowJob p = j.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition(
"chuckNorris()\n" +
"semaphore 'wait'\n"
));
, true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
SemaphoreStep.waitForStart("wait/1", b1);

Expand All @@ -112,11 +93,11 @@ public void evaluate() throws Throwable {
SemaphoreStep.success("wait/1", null);
SemaphoreStep.failure("wait/2", new Exception());

story.j.waitForCompletion(b1);
story.j.assertBuildStatus(Result.SUCCESS, b1);
j.waitForCompletion(b1);
j.assertBuildStatus(Result.SUCCESS, b1);

story.j.waitForCompletion(b1);
story.j.assertBuildStatus(Result.FAILURE, b2);
j.waitForCompletion(b2);
j.assertBuildStatus(Result.FAILURE, b2);

RoundhouseAction action1 = b1.getAction(RoundhouseAction.class);
assertEquals(Style.THUMB_UP, action1.getStyle());
Expand All @@ -130,7 +111,5 @@ public void evaluate() throws Throwable {
RoundhouseAction projectAction = p.getAction(RoundhouseAction.class);
assertEquals(Style.BAD_ASS, projectAction.getStyle());
assertNotNull(projectAction.getFact());
}
});
}
}