Skip to content

Commit 4670aa9

Browse files
committed
chore: container build config changes
1 parent 1a86bbb commit 4670aa9

File tree

8 files changed

+80
-63
lines changed

8 files changed

+80
-63
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ jobs:
118118
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_SECRET_KEY_ID }}
119119
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SECRET_KEY }}
120120
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SECRET_KEY_PASSWORD }}
121-
ORG_GRADLE_PROJECT_githubActor: ${{ github.repository_owner }}
121+
ORG_GRADLE_PROJECT_githubActor: ${{ github.actor }}
122122
ORG_GRADLE_PROJECT_githubToken: ${{ secrets.GITHUB_TOKEN }}
123123
# JOB_CONTEXT: ${{ toJSON(job) }}
124124
# STEPS_CONTEXT: ${{ toJSON(steps) }}

backend/jvm/build.gradle.kts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import com.github.ajalt.mordant.rendering.TextColors
21
import com.google.cloud.tools.jib.api.buildplan.ImageFormat
32
import com.google.devtools.ksp.gradle.KspAATask
43
import common.*
@@ -141,22 +140,6 @@ tasks {
141140
// Makes sure jte is generated before compilation
142141
withType<KspAATask>().configureEach { dependsOn(generateJte) }
143142

144-
jibDockerBuild {
145-
doLast {
146-
val portMapping = jib?.container?.ports.orEmpty().joinToString(" ") { "-p $it:$it" }
147-
val image = jib?.to?.image ?: project.name
148-
val tag = jib?.to?.tags?.firstOrNull() ?: "latest"
149-
val env =
150-
jib?.container?.environment.orEmpty().map { "-e ${it.key}=${it.value}" }.joinToString(" ")
151-
logger.lifecycle(
152-
TextColors.cyan(
153-
"""
154-
|Run: docker run -it --rm --name ${project.name} $portMapping $env $image:$tag
155-
"""
156-
.trimMargin()))
157-
}
158-
}
159-
160143
// publish { finalizedBy(jibDockerBuild) }
161144
}
162145

backend/native/build.gradle.kts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink
1313

1414
plugins {
1515
plugins.kotlin.mpp
16-
plugins.publishing
1716
com.google.cloud.tools.jib
17+
plugins.publishing
1818
}
1919

2020
val appBinName = "app"
@@ -148,20 +148,7 @@ tasks {
148148
rename { appBinName }
149149
}
150150

151-
jibDockerBuild {
152-
dependsOn(prepareJib)
153-
doLast {
154-
val portMapping = jib?.container?.ports.orEmpty().joinToString(" ") { "-p $it:$it" }
155-
val image = jib?.to?.image ?: project.name
156-
val tag = jib?.to?.tags?.firstOrNull() ?: "latest"
157-
logger.lifecycle(
158-
TextColors.cyan(
159-
"""
160-
|Run: docker run -it --rm --name ${project.name} $portMapping $image:$tag
161-
"""
162-
.trimMargin()))
163-
}
164-
}
151+
jibDockerBuild { dependsOn(prepareJib) }
165152

166153
// publish { finalizedBy(jibDockerBuild) }
167154
}

gradle/build-logic/src/main/kotlin/common/ProjectExtns.kt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ internal val Project.catalogs
5050
val Project.xQuote
5151
get() = if (OperatingSystem.current().isWindows) """\"""" else """""""
5252

53+
val Project.isRootProject
54+
get() = this == rootProject
55+
5356
val Project.sharedProjectName
5457
get() = "shared"
5558

@@ -104,19 +107,6 @@ val Project.kotlinApiVersion
104107
val Project.kotlinLangVersion
105108
get() = libs.versions.kotlin.lang.version.map { KotlinVersion.fromVersion(it) }
106109

107-
/** Kotlin Dependencies extension functions. */
108-
val Project.isKotlinMultiplatformProject
109-
get() = plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")
110-
111-
val Project.isKotlinJvmProject
112-
get() = plugins.hasPlugin("org.jetbrains.kotlin.jvm")
113-
114-
val Project.isKotlinJsProject
115-
get() = plugins.hasPlugin("org.jetbrains.kotlin.js")
116-
117-
val Project.isRootProject
118-
get() = this == rootProject
119-
120110
val Project.orgName
121111
get() = libs.versions.org.name.get()
122112

@@ -151,6 +141,16 @@ val Project.githubActor
151141
val Project.githubToken
152142
get() = providers.gradleProperty("githubToken")
153143

144+
/** Kotlin Dependencies extension functions. */
145+
val Project.isKotlinMultiplatformProject
146+
get() = plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")
147+
148+
val Project.isKotlinJvmProject
149+
get() = plugins.hasPlugin("org.jetbrains.kotlin.jvm")
150+
151+
val Project.isKotlinJsProject
152+
get() = plugins.hasPlugin("org.jetbrains.kotlin.js")
153+
154154
@Suppress("UnstableApiUsage")
155155
val Project.gradleSystemProperties
156156
get() =
@@ -167,8 +167,7 @@ fun Project.withJavaModule(moduleName: String, supportedInNative: Boolean = fals
167167
withType<JavaExec>().configureEach { jvmArgs(argsToAdd) }
168168
if (supportedInNative) {
169169
project.pluginManager.withPlugin("org.graalvm.buildtools.native") {
170-
val ext = project.extensions.findByType(GraalVMExtension::class.java)
171-
ext?.binaries?.all { jvmArgs(argsToAdd) }
170+
the<GraalVMExtension>().binaries.all { jvmArgs(argsToAdd) }
172171
}
173172
}
174173
}

gradle/build-logic/src/main/kotlin/plugins/kotlin.jvm.gradle.kts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package plugins
22

3+
import com.github.ajalt.mordant.rendering.TextColors
4+
import com.google.cloud.tools.jib.gradle.BuildDockerTask
35
import com.google.devtools.ksp.gradle.KspAATask
46
import common.*
57
import java.util.jar.Attributes
@@ -171,6 +173,27 @@ tasks {
171173
}
172174

173175
processResources { dependsOn(copyOtelAgent) }
176+
177+
// Docker command to run the image
178+
withType<BuildDockerTask>().configureEach {
179+
doLast {
180+
val portMapping = jib?.container?.ports.orEmpty().joinToString(" ") { "-p $it:$it" }
181+
val image = jib?.to?.image ?: project.name
182+
val tag = jib?.to?.tags?.firstOrNull() ?: "latest"
183+
val env =
184+
jib?.container
185+
?.environment
186+
.orEmpty()
187+
.map { "-e ${it.key}=${it.value}" }
188+
.joinToString(" ")
189+
logger.lifecycle(
190+
TextColors.cyan(
191+
"""
192+
|Run: docker run -it --rm --name ${project.name} $portMapping $env $image:$tag
193+
"""
194+
.trimMargin()))
195+
}
196+
}
174197
}
175198
}
176199

gradle/build-logic/src/main/kotlin/plugins/publishing.gradle.kts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package plugins
22

3+
import com.google.cloud.tools.jib.gradle.JibExtension
34
import common.*
45
import nmcp.NmcpPublishTask
56
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink
@@ -97,6 +98,20 @@ publishing {
9798
}
9899
}
99100

101+
// Configures GHCR credentials for Jib
102+
pluginManager.withPlugin("com.google.cloud.tools.jib") {
103+
the<JibExtension>().run {
104+
to {
105+
if (image.orEmpty().startsWith("ghcr.io", ignoreCase = true)) {
106+
auth {
107+
username = githubActor.orNull ?: System.getenv("GITHUB_ACTOR")
108+
password = githubToken.orNull ?: System.getenv("GITHUB_TOKEN")
109+
}
110+
}
111+
}
112+
}
113+
}
114+
100115
signing {
101116
setRequired { hasSigningKey }
102117
if (hasSigningKey) {

gradle/kotlin-js-store/package-lock.json

Lines changed: 20 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradle/libs.versions.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ kotlinx-multik = "0.2.3"
4141
kotlinx-dataframe = "0.13.1"
4242
kotlinx-kandy = "0.5.0"
4343
karakum = "1.0.0-alpha.40-K2"
44-
seskar = "2.80.0"
45-
spring-boot = "3.3.0"
44+
seskar = "3.0.0"
45+
spring-boot = "3.3.1"
4646
spring-depmgmt = "1.1.5"
4747
ktor = "3.0.0-beta-1"
4848
ktor-cohort = "2.5.1"
@@ -58,7 +58,7 @@ zip-prefixer = "0.3.1"
5858
ajalt-mordant = "2.6.0"
5959
ajalt-clikt = "4.4.0"
6060
ajalt-colormath = "3.5.0"
61-
classgraph = "4.8.172"
61+
classgraph = "4.8.174"
6262
cache4k = "0.11.0"
6363
intellij-coverage = "1.0.754"
6464
intellij-markdown = "0.7.3"
@@ -137,12 +137,12 @@ async-profiler = "3.0"
137137
ap-loader-all = "3.0-9"
138138
openjdk-jmc = "9.0.0"
139139
airlift-aircompressor = "0.27"
140-
airlift-security = "248"
140+
airlift-security = "249"
141141
directory-keystore = "1.1.0"
142142
maven-mima = "3.0.0-alpha-3"
143143
maven-archeologist = "0.0.10"
144144
jfree-chart = "1.5.4"
145-
jfree-svg = "5.0.5"
145+
jfree-svg = "5.0.6"
146146
xchart = "3.8.7"
147147
batik = "1.17"
148148
twelvemonkeys = "3.10.1"

0 commit comments

Comments
 (0)