Skip to content

Commit

Permalink
Merge pull request #17 from rundeck-plugins/RUN-1770
Browse files Browse the repository at this point in the history
use http-step plugin as dependency
  • Loading branch information
ltamaster authored Jun 1, 2023
2 parents 1bff204 + 65160b4 commit 1e005d3
Show file tree
Hide file tree
Showing 7 changed files with 242 additions and 385 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Java CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get Fetch Tags
run: git -c protocol.version=2 fetch --tags --progress --no-recurse-submodules origin
if: "!contains(github.ref, 'refs/tags')"
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Get Release Version
id: get_version
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo ::set-output name=VERSION::$VERSION
- name: Upload plugin jar
uses: actions/upload-artifact@v1.0.0
with:
# Artifact name
name: Grails-Plugin-${{ steps.get_version.outputs.VERSION }}
# Directory containing files to upload
path: build/libs/http-notification-plugin-${{ steps.get_version.outputs.VERSION }}.jar
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Upload Release Asset

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew build
- name: Get Release Version
id: get_version
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo ::set-output name=VERSION::$VERSION
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- name: Upload Release Asset (jar)
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/libs/http-notification-plugin-${{ steps.get_version.outputs.VERSION }}.jar
asset_name: http-notification-plugin-${{ steps.get_version.outputs.VERSION }}.jar
asset_content_type: application/octet-stream
43 changes: 21 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

buildscript {
repositories {
mavenCentral()
Expand All @@ -6,7 +7,7 @@ buildscript {
}

plugins {
id 'pl.allegro.tech.build.axion-release' version '1.10.0'
id 'pl.allegro.tech.build.axion-release' version '1.13.4'
}

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


scmVersion {
ignoreUncommittedChanges = false
ignoreUncommittedChanges = true
tag {
prefix = ''
versionSeparator = ''
Expand All @@ -45,35 +46,34 @@ configurations{
pluginLibs

//declare compile to extend from pluginLibs so it inherits the dependencies
compile{
implementation{
extendsFrom pluginLibs
}
}

repositories {
mavenCentral()
mavenLocal()
maven { url 'https://jitpack.io' }

}

dependencies {
compile group: 'org.rundeck', name: 'rundeck-core', version: '2.10.1'
compile 'org.slf4j:slf4j-api:1.7.30'
pluginLibs (group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1') {
exclude (group: "commons-collections", module: "commons-collections")
exclude (group: "commons-beanutils", module: "commons-beanutils")
implementation 'org.rundeck:rundeck-core:4.13.0-20230515'

pluginLibs ('com.github.rundeck-plugins:http-step:1.1.2'){
exclude group: 'org.rundeck', module: 'rundeck-core'
}
// bump xerces version brought by http-builder affected by CVE-2012-0881
pluginLibs("xerces:xercesImpl:2.12.0")
pluginLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
pluginLibs group: 'com.esotericsoftware.yamlbeans', name: 'yamlbeans', version: '1.13'

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

testImplementation group: 'junit', name: 'junit', version: '4.13.1'

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

}

Expand Down Expand Up @@ -110,7 +110,6 @@ jar {
//set jar task to depend on copyToLib
jar.dependsOn(copyToLib)

task wrapper(type: Wrapper) {
gradleVersion = '3.3'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
tasks.withType(Test) {
useJUnitPlatform()
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
55 changes: 55 additions & 0 deletions src/main/groovy/com/rundeck/plugin/HttpLogger.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.rundeck.plugin

import com.dtolabs.rundeck.plugins.PluginLogger
import groovy.transform.CompileStatic
import org.slf4j.Logger

@CompileStatic
class HttpLogger implements PluginLogger{

Logger log

HttpLogger(Logger log) {
this.log = log
}

@Override
void log(int level, String message) {
printMessage(level, message)

}

@Override
void log(int level, String message, Map eventMeta) {
printMessage(level, message)
}

@Override
void event(String eventType, String message, Map eventMeta) {

}

void printMessage(int level, String message){
switch (level){
case 0:
log.error(message)
break
case 1:
log.warn(message)
break
case 2:
log.info(message)
break
case 3:
log.info(message)
break
case 4:
log.debug(message)
break
default:
log.info(message)
break
}
}

}
Loading

0 comments on commit 1e005d3

Please sign in to comment.