Skip to content

Commit 74aa6f0

Browse files
authored
Merge pull request #199 from rundeck-plugins/grails7-upgrade
Grails 7 Migration - Rundeck 6.0 Compatibility
2 parents 6c6d94c + 431e29f commit 74aa6f0

9 files changed

Lines changed: 357 additions & 164 deletions

File tree

.github/workflows/gradle.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ jobs:
1414
- name: Get Fetch Tags
1515
run: git -c protocol.version=2 fetch --tags --progress --no-recurse-submodules origin
1616
if: "!contains(github.ref, 'refs/tags')"
17-
- name: Set up JDK 1.8
18-
uses: actions/setup-java@v1
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v4
1919
with:
20-
java-version: 1.8
20+
java-version: '17'
21+
distribution: 'zulu'
2122
- name: Grant execute permission for gradlew
2223
run: chmod +x gradlew
2324
- name: Build with Gradle
@@ -26,7 +27,7 @@ jobs:
2627
id: get_version
2728
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
2829
- name: Upload artifact zip
29-
uses: actions/upload-artifact@v4.0.0
30+
uses: actions/upload-artifact@v4
3031
with:
3132
# Artifact name
3233
name: kubernetes-${{ steps.get_version.outputs.VERSION }}

.github/workflows/release.yml

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,42 @@
11
on:
22
push:
3-
# Sequence of patterns matched against refs/tags
43
tags:
5-
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10
4+
- '*.*.*'
65

7-
name: Create Release
6+
name: Publish Release
87

98
jobs:
109
build:
11-
name: Upload Release Asset
10+
name: Publish Release
1211
runs-on: ubuntu-latest
1312
steps:
1413
- name: Checkout code
15-
uses: actions/checkout@v2
14+
uses: actions/checkout@v4
1615
with:
1716
fetch-depth: 0
18-
- name: set up JDK 1.8
19-
uses: actions/setup-java@v1
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v4
2019
with:
21-
java-version: 1.8
20+
java-version: '17'
21+
distribution: 'zulu'
2222
- name: Build with Gradle
2323
run: ./gradlew build
2424
- name: Get Release Version
2525
id: get_version
26-
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo ::set-output name=VERSION::$VERSION
26+
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
2727
- name: Create Release
28-
id: create_release
29-
uses: actions/create-release@v1.0.0
28+
run: |
29+
gh release create \
30+
--generate-notes \
31+
--title 'Release ${{ steps.get_version.outputs.VERSION }}' \
32+
${{ github.ref_name }} \
33+
build/libs/kubernetes-${{ steps.get_version.outputs.VERSION }}.zip
3034
env:
3135
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 Zip
38-
id: upload-release-asset
39-
uses: actions/upload-release-asset@v1
36+
- name: Publish to Maven Central
37+
run: ./gradlew -PsigningKey=${SIGNING_KEY_B64} -PsigningPassword=${SIGNING_PASSWORD} -PsonatypeUsername=${SONATYPE_USERNAME} -PsonatypePassword=${SONATYPE_PASSWORD} publishToSonatype closeAndReleaseSonatypeStagingRepository
4038
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
with:
43-
upload_url: ${{ steps.create_release.outputs.upload_url }}
44-
asset_path: build/libs/kubernetes-${{ steps.get_version.outputs.VERSION }}.zip
45-
asset_name: kubernetes-${{ steps.get_version.outputs.VERSION }}.zip
46-
asset_content_type: application/octet-stream
47-
39+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
40+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
41+
SIGNING_KEY_B64: ${{ secrets.SIGNING_KEY_B64 }}
42+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}

build.gradle

Lines changed: 89 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1+
import org.apache.tools.ant.filters.ReplaceTokens
2+
13
buildscript {
24
repositories {
35
mavenCentral()
46
}
57
}
8+
69
plugins {
7-
id 'pl.allegro.tech.build.axion-release' version '1.14.2'
10+
id 'base'
11+
id 'pl.allegro.tech.build.axion-release' version '1.17.2'
12+
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
813
}
914

15+
group = 'org.rundeck.plugins'
16+
1017
ext.pluginName = 'kubernetes'
1118
ext.pluginDescription = "Kubernetes Rundeck Plugin to manage pods , deployments, etc"
1219
ext.sopsCopyright = "© 2018, Rundeck, Inc."
@@ -16,16 +23,91 @@ ext.archivesBaseName = "kubernetes"
1623
ext.pluginBaseFolder = "."
1724

1825
scmVersion {
19-
ignoreUncommittedChanges = true
26+
ignoreUncommittedChanges = false
2027
tag {
21-
prefix = ''
28+
prefix = '' // NO "v" prefix - see PLUGIN_TAGGING_ARCHITECTURE.md
2229
versionSeparator = ''
23-
def origDeserialize=deserialize
30+
}
31+
versionCreator 'simple' // Use simple version creator (just tag name)
32+
}
33+
34+
version = scmVersion.version // Dynamic version from git tag
35+
ext.publishName = "Kubernetes ${project.version}"
36+
ext.githubSlug = 'rundeck-plugins/kubernetes'
37+
ext.developers = [
38+
[id: 'gschueler', name: 'Greg Schueler', email: 'greg@rundeck.com']
39+
]
40+
41+
// ZIP plugin task - must use Jar type for proper manifest handling
42+
task pluginZip(type: Jar) {
43+
archiveBaseName = archivesBaseName
44+
archiveVersion = version
45+
archiveClassifier = ''
46+
archiveExtension = 'zip'
47+
destinationDirectory = layout.buildDirectory.dir('libs')
48+
49+
from(layout.buildDirectory.dir('zip-contents')) {
50+
include('*.yaml')
51+
include('resources/**')
52+
include('contents/*')
53+
into("${archivesBaseName}-" + project.version.toString())
54+
}
55+
56+
manifest {
57+
attributes(
58+
'Rundeck-Plugin-Name': pluginName,
59+
'Rundeck-Plugin-Description': pluginDescription,
60+
'Rundeck-Plugin-Archive': 'true',
61+
'Rundeck-Plugin-File-Version': project.version.toString(),
62+
'Rundeck-Plugin-Author': sopsCopyright,
63+
'Rundeck-Plugin-URL': sopsUrl,
64+
'Rundeck-Plugin-Date': buildDateString
65+
)
66+
}
67+
}
68+
69+
pluginZip.doFirst {
70+
def assetsMap = new Properties()
71+
def tokens = assetsMap + [
72+
version : project.version.toString(),
73+
date : buildDateString,
74+
author : sopsCopyright,
75+
url : sopsUrl,
76+
title : pluginName,
77+
description: pluginDescription,
78+
name : archivesBaseName,
79+
]
80+
81+
copy {
82+
from(file('resources')) {
83+
include('**/*')
84+
into('resources')
85+
}
86+
87+
from(file('contents')) {
88+
into('contents')
89+
}
2490

91+
from('plugin.yaml') {
92+
filter(ReplaceTokens, tokens: tokens)
93+
exclude('**/*.png')
94+
}
95+
96+
into(layout.buildDirectory.dir('zip-contents'))
2597
}
2698
}
2799

28-
project.version = scmVersion.version
29-
ext.archiveFilename = ext.archivesBaseName + '-' + version
100+
// Wire into build lifecycle
101+
assemble.dependsOn pluginZip
102+
103+
nexusPublishing {
104+
packageGroup = 'org.rundeck.plugins'
105+
repositories {
106+
sonatype {
107+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
108+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
109+
}
110+
}
111+
}
30112

31-
apply from: 'https://raw.githubusercontent.com/rundeck-plugins/build-zip/gradle-5.6/build.gradle'
113+
apply from: "${rootDir}/gradle/publishing.gradle"

gradle/publishing.gradle

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/**
2+
* Zip-based Rundeck plugin publication for Maven Central (artifact uploaded as type jar).
3+
* Requires: ext.publishName, ext.githubSlug, ext.developers; task pluginZip
4+
*/
5+
apply plugin: 'maven-publish'
6+
apply plugin: 'signing'
7+
8+
publishing {
9+
publications {
10+
mavenZip(MavenPublication) {
11+
groupId = project.group.toString()
12+
artifactId = 'kubernetes'
13+
version = project.version.toString()
14+
15+
artifact(tasks.named('pluginZip')) {
16+
extension = 'jar'
17+
}
18+
19+
pom {
20+
packaging = 'jar'
21+
name = publishName
22+
description = project.ext.hasProperty('publishDescription') ? project.ext.publishDescription :
23+
project.description ?: publishName
24+
url = "https://github.com/${githubSlug}"
25+
licenses {
26+
license {
27+
name = 'The Apache Software License, Version 2.0'
28+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
29+
distribution = 'repo'
30+
}
31+
}
32+
scm {
33+
url = "https://github.com/${githubSlug}"
34+
connection = "scm:git:git@github.com/${githubSlug}.git"
35+
developerConnection = "scm:git:git@github.com:${githubSlug}.git"
36+
}
37+
if (project.ext.developers) {
38+
developers {
39+
project.ext.developers.each { dev ->
40+
developer {
41+
id = dev.id
42+
name = dev.name
43+
email = dev.email
44+
}
45+
}
46+
}
47+
}
48+
}
49+
}
50+
}
51+
repositories {
52+
def pkgcldWriteToken = System.getenv("PKGCLD_WRITE_TOKEN") ?: project.findProperty("pkgcldWriteToken")
53+
if (pkgcldWriteToken) {
54+
maven {
55+
name = "PackageCloudTest"
56+
url = uri("https://packagecloud.io/pagerduty/rundeckpro-test/maven2")
57+
authentication {
58+
header(HttpHeaderAuthentication)
59+
}
60+
credentials(HttpHeaderCredentials) {
61+
name = "Authorization"
62+
value = "Bearer " + pkgcldWriteToken
63+
}
64+
}
65+
}
66+
}
67+
}
68+
69+
def base64Decode = { String prop ->
70+
project.findProperty(prop) ?
71+
new String(Base64.getDecoder().decode(project.findProperty(prop).toString())).trim() :
72+
null
73+
}
74+
75+
if (project.hasProperty('signingKey') && project.hasProperty('signingPassword')) {
76+
signing {
77+
useInMemoryPgpKeys(base64Decode("signingKey"), project.signingPassword)
78+
sign(publishing.publications)
79+
}
80+
}

gradle/wrapper/gradle-wrapper.jar

3.83 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)