diff --git a/fullstack-examples/build.gradle.kts b/fullstack-examples/build.gradle.kts index eb615572..5ec8a79d 100644 --- a/fullstack-examples/build.gradle.kts +++ b/fullstack-examples/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Hedera Hashgraph, LLC + * Copyright (C) 2023-2024 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,18 @@ * limitations under the License. */ +import com.hedera.fullstack.gradle.plugin.HelmDependencyUpdateTask +import com.hedera.fullstack.gradle.plugin.HelmInstallChartTask +import com.hedera.fullstack.gradle.plugin.HelmReleaseExistsTask +import com.hedera.fullstack.gradle.plugin.HelmTestChartTask +import com.hedera.fullstack.gradle.plugin.HelmUninstallChartTask +import com.hedera.fullstack.gradle.plugin.kind.release.KindArtifactTask + plugins { id("com.hedera.fullstack.root") id("com.hedera.fullstack.conventions") id("com.hedera.fullstack.jpms-modules") + id("com.hedera.fullstack.fullstack-gradle-plugin") } dependencies { @@ -25,6 +33,55 @@ dependencies { implementation(platform("com.hedera.fullstack:fullstack-bom")) } +tasks.register("helmInstallFstChart") { + createNamespace.set(true) + namespace.set("fst-ns") + release.set("fst") + chart.set("../charts/fullstack-deployment") +} + +tasks.register("helmInstallNginxChart") { + createNamespace.set(true) + namespace.set("nginx-ns") + release.set("nginx-release") + chart.set("oci://ghcr.io/nginxinc/charts/nginx-ingress") +} + +tasks.register("helmUninstallNginxChart") { + namespace.set("nginx-ns") + release.set("nginx-release") +} + +tasks.register("helmNginxExists") { + allNamespaces.set(true) + namespace.set("nginx-ns") + release.set("nginx-release") +} + +tasks.register("helmDependencyUpdate") { + chartName.set("../charts/fullstack-deployment") +} + +tasks.register("helmTestNginxChart") { + namespace.set("nginx-ns") + release.set("nginx-release") +} + +// This task will succeed because it only uninstalls if the release exists +tasks.register("helmUninstallNotAChart") { + release.set("not-a-release") + ifExists.set(true) +} + +val kindVersion = "0.20.0" + +tasks.register("kindArtifact") { version.set(kindVersion) } tasks.check { + dependsOn("helmInstallNginxChart") + dependsOn("helmNginxExists") + dependsOn("helmTestNginxChart") + dependsOn("helmUninstallNginxChart") + dependsOn("helmDependencyUpdate") + dependsOn("helmUninstallNotAChart") } diff --git a/fullstack-gradle-plugin/build.gradle.kts b/fullstack-gradle-plugin/build.gradle.kts index e79f95f5..cff571e8 100644 --- a/fullstack-gradle-plugin/build.gradle.kts +++ b/fullstack-gradle-plugin/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Hedera Hashgraph, LLC + * Copyright (C) 2023-2024 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,12 +26,26 @@ plugins { dependencies { api(platform("com.hedera.fullstack:fullstack-bom")) + implementation("com.hedera.fullstack:fullstack-helm-client") implementation(kotlin("stdlib-jdk8")) implementation("net.swiftzer.semver:semver:1.1.2") testImplementation("org.assertj:assertj-core:3.24.2") testImplementation(kotlin("test")) } +gradlePlugin { + plugins { + create("fullstackPlugin") { + id = "com.hedera.fullstack.fullstack-gradle-plugin" + group = "com.hedera.fullstack" + implementationClass = "com.hedera.fullstack.gradle.plugin.FullstackPlugin" + displayName = "Fullstack Plugin" + description = + "The Fullstack Plugin provides tools for working with Fullstack infrastructure." + } + } +} + repositories { mavenCentral() } kotlin { jvmToolchain(21) }