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

chore: update dependencies/itests & remove vault(secret) function #10

Merged
merged 12 commits into from
Aug 12, 2024
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
107 changes: 0 additions & 107 deletions .circleci/config.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/pre-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Pre Merge Checks

on:
push:
branches:
- main
pull_request:
branches:
- '*'

jobs:
gradle:
runs-on: ubuntu-latest
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache
uses: gradle/gradle-build-action@v2.4.2
- name: Validate
run: ./gradlew check validatePlugins --continue
- name: Integration Test
run: ./gradlew integrationTest --info

24 changes: 24 additions & 0 deletions .github/workflows/publish-plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish to Gradle Plugin Portal

on:
push:
tags:
- '*'

jobs:
gradle:
runs-on: ubuntu-latest
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache
uses: gradle/gradle-build-action@v2.4.2
- name: Validate
run: ./gradlew check validatePlugins --continue
- name: Integration Test
run: ./gradlew integrationTest
- name: Publish
run: ./gradlew publishPlugins
87 changes: 45 additions & 42 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import net.nemerosa.versioning.tasks.VersionDisplayTask

plugins {
`kotlin-dsl`
`maven-publish`
id("com.gradle.plugin-publish") version "0.18.0"
id("net.nemerosa.versioning") version "2.15.1"
alias(libs.plugins.gradlePluginPublish)
alias(libs.plugins.nemerosaVersioning)
}

group = "com.liftric.vault"
Expand All @@ -15,81 +12,87 @@ allprojects {
} else {
full
}
}.also {
println("version=$it")
}
}

repositories {
mavenCentral()
gradlePluginPortal()
}

sourceSets {
val main by getting
val integrationMain by creating {
compileClasspath += main.output
runtimeClasspath += main.output
}
}


dependencies {
implementation(gradleApi())
implementation(kotlin("gradle-plugin"))
implementation(kotlin("stdlib-jdk8"))
implementation("com.bettercloud:vault-java-driver:5.1.0")
implementation(libs.javaVaultDriver)

testImplementation(gradleTestKit())
testImplementation("junit:junit:4.13.2")
testImplementation("com.github.stefanbirkner:system-rules:1.19.0")
testImplementation(libs.junitJupiter)

"integrationMainImplementation"(gradleTestKit())
"integrationMainImplementation"(libs.junitJupiter)
"integrationMainImplementation"(libs.javaVaultDriver)
"integrationMainImplementation"(libs.testContainersJUnit5)
"integrationMainImplementation"(libs.testContainersMain)
}


tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
withType<VersionDisplayTask> {
doLast {
println("[VersionDisplayTask] version=$version")
}
}
val createVersionFile by creating {
doLast {
mkdir(buildDir)
file("$buildDir/version").apply {
if (exists()) delete()
createNewFile()
writeText(project.version.toString())
}

val test by existing
withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
systemProperty("org.gradle.testkit.dir", gradle.gradleUserHomeDir)
}
val build by existing
val publish by existing
val publishToMavenLocal by existing
listOf(build.get(), publish.get(), publishToMavenLocal.get()).forEach { it.dependsOn(createVersionFile) }

val setupPluginsLogin by creating {
// see: https://github.com/gradle/gradle/issues/1246
val publishKey: String? = System.getenv("GRADLE_PUBLISH_KEY")
val publishSecret: String? = System.getenv("GRADLE_PUBLISH_SECRET")
if (publishKey != null && publishSecret != null) {
println("[setupPluginsLogin] seeting plugin portal credentials from env")
System.getProperties().setProperty("gradle.publish.key", publishKey)
System.getProperties().setProperty("gradle.publish.secret", publishSecret)
}
register<Test>("integrationTest") {
val integrationMain by sourceSets
description = "Runs the integration tests"
group = "verification"
testClassesDirs = integrationMain.output.classesDirs
classpath = integrationMain.runtimeClasspath
mustRunAfter(test)
useJUnitPlatform()
}
val publishPlugins by existing
publishPlugins.get().dependsOn(setupPluginsLogin)
}

publishing {
repositories {
mavenLocal()
}
}

gradlePlugin {
website.set("https://github.com/Liftric/vault-client-plugin")
vcsUrl.set("https://github.com/Liftric/vault-client-plugin")
testSourceSets(sourceSets["integrationMain"])
plugins {
create("VaultClientPlugin") {
id = "com.liftric.vault-client-plugin"
displayName = "vault-client-plugin"
implementationClass = "com.liftric.vault.VaultClientPlugin"
description = "Read and use vault secrets in your build script"
tags.set(listOf("vault", "hashicorp", "secret"))
}
}
}
pluginBundle {
website = "https://github.com/Liftric/vault-client-plugin"
vcsUrl = "https://github.com/Liftric/vault-client-plugin"
description = "Gradle plugin to use Vault secrets in build scripts"
tags = listOf("vault", "hashicorp", "secret")
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:
vault:
build:
dockerfile: vault.docker
dockerfile: vault.Dockerfile
context: .
environment:
VAULT_DEV_ROOT_TOKEN_ID: myroottoken
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
40 changes: 0 additions & 40 deletions integration-token/build.gradle.kts

This file was deleted.

12 changes: 0 additions & 12 deletions integration-token/buildSrc/build.gradle.kts

This file was deleted.

13 changes: 0 additions & 13 deletions integration-token/buildSrc/src/main/kotlin/Configs.kt

This file was deleted.

Binary file removed integration-token/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 0 additions & 5 deletions integration-token/gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Loading
Loading