Skip to content

Commit 1e005d3

Browse files
authored
Merge pull request #17 from rundeck-plugins/RUN-1770
use http-step plugin as dependency
2 parents 1bff204 + 65160b4 commit 1e005d3

File tree

7 files changed

+242
-385
lines changed

7 files changed

+242
-385
lines changed

.github/workflows/gradle.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Java CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
- name: Get Fetch Tags
15+
run: git -c protocol.version=2 fetch --tags --progress --no-recurse-submodules origin
16+
if: "!contains(github.ref, 'refs/tags')"
17+
- name: Set up JDK 1.8
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 1.8
21+
- name: Grant execute permission for gradlew
22+
run: chmod +x gradlew
23+
- name: Build with Gradle
24+
run: ./gradlew build
25+
- name: Get Release Version
26+
id: get_version
27+
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo ::set-output name=VERSION::$VERSION
28+
- name: Upload plugin jar
29+
uses: actions/[email protected]
30+
with:
31+
# Artifact name
32+
name: Grails-Plugin-${{ steps.get_version.outputs.VERSION }}
33+
# Directory containing files to upload
34+
path: build/libs/http-notification-plugin-${{ steps.get_version.outputs.VERSION }}.jar

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
push:
3+
# Sequence of patterns matched against refs/tags
4+
tags:
5+
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10
6+
7+
name: Upload Release Asset
8+
9+
jobs:
10+
build:
11+
name: Upload Release Asset
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
- name: set up JDK 1.8
19+
uses: actions/setup-java@v1
20+
with:
21+
java-version: 1.8
22+
- name: Build with Gradle
23+
run: ./gradlew build
24+
- name: Get Release Version
25+
id: get_version
26+
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo ::set-output name=VERSION::$VERSION
27+
- name: Create Release
28+
id: create_release
29+
uses: actions/[email protected]
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
with:
33+
tag_name: ${{ github.ref }}
34+
release_name: Release ${{ steps.get_version.outputs.VERSION }}
35+
draft: false
36+
prerelease: false
37+
- name: Upload Release Asset (jar)
38+
id: upload-release-asset
39+
uses: actions/upload-release-asset@v1
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
upload_url: ${{ steps.create_release.outputs.upload_url }}
44+
asset_path: build/libs/http-notification-plugin-${{ steps.get_version.outputs.VERSION }}.jar
45+
asset_name: http-notification-plugin-${{ steps.get_version.outputs.VERSION }}.jar
46+
asset_content_type: application/octet-stream

build.gradle

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
buildscript {
23
repositories {
34
mavenCentral()
@@ -6,7 +7,7 @@ buildscript {
67
}
78

89
plugins {
9-
id 'pl.allegro.tech.build.axion-release' version '1.10.0'
10+
id 'pl.allegro.tech.build.axion-release' version '1.13.4'
1011
}
1112

1213
group 'com.rundeck.plugin'
@@ -23,7 +24,7 @@ ext.pluginDescription = 'A notification plugin that makes HTTP requests'
2324

2425

2526
scmVersion {
26-
ignoreUncommittedChanges = false
27+
ignoreUncommittedChanges = true
2728
tag {
2829
prefix = ''
2930
versionSeparator = ''
@@ -45,35 +46,34 @@ configurations{
4546
pluginLibs
4647

4748
//declare compile to extend from pluginLibs so it inherits the dependencies
48-
compile{
49+
implementation{
4950
extendsFrom pluginLibs
5051
}
5152
}
5253

5354
repositories {
5455
mavenCentral()
56+
mavenLocal()
57+
maven { url 'https://jitpack.io' }
58+
5559
}
5660

5761
dependencies {
58-
compile group: 'org.rundeck', name: 'rundeck-core', version: '2.10.1'
59-
compile 'org.slf4j:slf4j-api:1.7.30'
60-
pluginLibs (group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1') {
61-
exclude (group: "commons-collections", module: "commons-collections")
62-
exclude (group: "commons-beanutils", module: "commons-beanutils")
62+
implementation 'org.rundeck:rundeck-core:4.13.0-20230515'
63+
64+
pluginLibs ('com.github.rundeck-plugins:http-step:1.1.2'){
65+
exclude group: 'org.rundeck', module: 'rundeck-core'
6366
}
64-
// bump xerces version brought by http-builder affected by CVE-2012-0881
65-
pluginLibs("xerces:xercesImpl:2.12.0")
66-
pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
67-
pluginLibs group: 'com.esotericsoftware.yamlbeans', name: 'yamlbeans', version: '1.13'
6867

69-
compile 'org.codehaus.groovy:groovy-all:2.3.11'
70-
testCompile group: 'junit', name: 'junit', version: '4.12'
68+
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.14'
69+
implementation 'org.codehaus.groovy:groovy-all:3.0.9'
7170

71+
testImplementation group: 'junit', name: 'junit', version: '4.13.1'
7272

73-
testCompile "org.codehaus.groovy:groovy-all:2.3.7"
74-
testCompile "org.spockframework:spock-core:0.7-groovy-2.0"
75-
testCompile "cglib:cglib-nodep:2.2.2"
76-
testCompile 'org.objenesis:objenesis:1.4'
73+
testImplementation "org.codehaus.groovy:groovy-all:3.0.17"
74+
testImplementation "org.spockframework:spock-core:2.0-groovy-3.0"
75+
testImplementation "cglib:cglib-nodep:2.2.2"
76+
testImplementation 'org.objenesis:objenesis:1.4'
7777

7878
}
7979

@@ -110,7 +110,6 @@ jar {
110110
//set jar task to depend on copyToLib
111111
jar.dependsOn(copyToLib)
112112

113-
task wrapper(type: Wrapper) {
114-
gradleVersion = '3.3'
115-
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
116-
}
113+
tasks.withType(Test) {
114+
useJUnitPlatform()
115+
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.rundeck.plugin
2+
3+
import com.dtolabs.rundeck.plugins.PluginLogger
4+
import groovy.transform.CompileStatic
5+
import org.slf4j.Logger
6+
7+
@CompileStatic
8+
class HttpLogger implements PluginLogger{
9+
10+
Logger log
11+
12+
HttpLogger(Logger log) {
13+
this.log = log
14+
}
15+
16+
@Override
17+
void log(int level, String message) {
18+
printMessage(level, message)
19+
20+
}
21+
22+
@Override
23+
void log(int level, String message, Map eventMeta) {
24+
printMessage(level, message)
25+
}
26+
27+
@Override
28+
void event(String eventType, String message, Map eventMeta) {
29+
30+
}
31+
32+
void printMessage(int level, String message){
33+
switch (level){
34+
case 0:
35+
log.error(message)
36+
break
37+
case 1:
38+
log.warn(message)
39+
break
40+
case 2:
41+
log.info(message)
42+
break
43+
case 3:
44+
log.info(message)
45+
break
46+
case 4:
47+
log.debug(message)
48+
break
49+
default:
50+
log.info(message)
51+
break
52+
}
53+
}
54+
55+
}

0 commit comments

Comments
 (0)