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

Update GH WFs to publish Java images for many platforms #6110

Merged
merged 1 commit into from Feb 17, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/renovate.json5
Expand Up @@ -26,6 +26,10 @@
matchManagers: ["pip_requirements", "pip_setup"],
"labels": ["dependencies", "python"],
},
{
matchManagers: ["docker"],
"labels": ["dependencies", "docker"],
},

// Check for updates, merge automatically
{
Expand Down Expand Up @@ -58,7 +62,14 @@
"org.glassfish.jersey:jersey-bom",
],
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
}
},

// Docker
{
matchManagers: ["docker"],
automerge: false,
platformAutomerge: false
},
],

// Max 50 PRs in total, 10 per hour
Expand Down
48 changes: 20 additions & 28 deletions .github/workflows/release-publish.yml
Expand Up @@ -118,22 +118,31 @@ jobs:
MAVEN_USERNAME: ${{ secrets.OSSRH_ACCESS_ID }}
MAVEN_OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
ARTIFACTS: ../build-artifacts
run: |
rm -rf "${ARTIFACTS}"
mkdir -p "${ARTIFACTS}"

echo "::group::Publish to Sonatype"
./gradlew --no-watch-fs --no-daemon publishToMavenLocal publishToSonatype closeAndReleaseSonatypeStagingRepository -Prelease -Puber-jar
mv servers/quarkus-server/build/nessie-quarkus-${RELEASE_VERSION}-runner.jar "${ARTIFACTS}"
mv servers/quarkus-cli/build/nessie-quarkus-cli-${RELEASE_VERSION}-runner.jar "${ARTIFACTS}"
echo "::endgroup::"

# Build the native-image, it's not released to Maven Central
echo "::group::Build native image"
./gradlew --no-watch-fs --no-daemon :nessie-quarkus:quarkusBuild -Prelease -Pnative -Pdocker
echo "::endgroup::"
echo '${{ secrets.DOCKER_TOKEN }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin
tools/dockerbuild/build-push-images.sh \
-a "${ARTIFACTS}" \
-g ":nessie-quarkus" \
-p "servers/quarkus-server" \
-n \
projectnessie/nessie

# Add version to the openapi file name
cp model/build/generated/openapi/META-INF/openapi/openapi.yaml model/build/nessie-openapi-${RELEASE_VERSION}.yaml

echo "QUARKUS_NATIVE_BINARY=servers/quarkus-server/build/nessie-quarkus-${RELEASE_VERSION}-runner" >> ${GITHUB_ENV}
echo "QUARKUS_UBER_JAR=servers/quarkus-server/build/nessie-quarkus-${RELEASE_VERSION}-runner.jar" >> ${GITHUB_ENV}
echo "CLI_UBER_JAR=servers/quarkus-cli/build/nessie-quarkus-cli-${RELEASE_VERSION}-runner.jar" >> ${GITHUB_ENV}
echo "QUARKUS_UBER_JAR=${ARTIFACTS}/nessie-quarkus-${RELEASE_VERSION}-runner.jar" >> ${GITHUB_ENV}
echo "CLI_UBER_JAR=${ARTIFACTS}/nessie-quarkus-cli-${RELEASE_VERSION}-runner.jar" >> ${GITHUB_ENV}
echo "QUARKUS_NATIVE_BINARY=${ARTIFACTS}/nessie-quarkus-${RELEASE_VERSION}-runner" >> ${GITHUB_ENV}
echo "GC_EXEC=gc/gc-shell/build/executable/nessie-gc" >> ${GITHUB_ENV}
echo "NESSIE_OPENAPI=model/build/nessie-openapi-${RELEASE_VERSION}.yaml" >> ${GITHUB_ENV}

Expand Down Expand Up @@ -177,26 +186,6 @@ jobs:
- name: pynessie info
run: echo "## Successfully published pynessie ${RELEASE_VERSION}" >> $GITHUB_STEP_SUMMARY

# Deploys Docker images. Build and test steps were already ran in previous workflows
- name: Publish Docker image for release
run: |
echo "## Docker publish ${RELEASE_VERSION}" >> $GITHUB_STEP_SUMMARY

echo "::group::Tag Docker image"
docker tag projectnessie/nessie:${RELEASE_VERSION} projectnessie/nessie:latest
echo "Successfully tagged Docker image as \`projectnessie/nessie:${RELEASE_VERSION}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "::endgroup::"

echo "::group::Docker Hub login"
echo '${{ secrets.DOCKER_TOKEN }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin
echo "::endgroup::"

echo "::group::Push Docker image"
docker push projectnessie/nessie:${RELEASE_VERSION} && docker push projectnessie/nessie:latest
echo "::endgroup::"
echo "Successfully pushed Docker image for ${RELEASE_VERSION}" >> $GITHUB_STEP_SUMMARY

# Prepare Nessie release notes for GitHub
#
# The markdown file for the release is generated using some mostly simple shell script.
Expand Down Expand Up @@ -229,7 +218,10 @@ jobs:

* ${NUM_COMMITS} commits since ${LAST_TAG#nessie-}
* Maven Central: https://search.maven.org/search?q=g:org.projectnessie+v:${RELEASE_VERSION}
* Docker Hub: https://hub.docker.com/r/projectnessie/nessie \`docker pull projectnessie/nessie:${RELEASE_VERSION}\`
* Docker Hub: https://hub.docker.com/r/projectnessie/nessie
* Multiplatform Java image (amd64, arm64, ppc64le, s390x): `projectnessie/nessie:${RELEASE_VERSION}-java\`
* Image with native amd64 binary: `projectnessie/nessie:${RELEASE_VERSION}-native\`
(only recommended for short running Nessie instances, amd64 only)
* PyPI: https://pypi.org/project/pynessie/${RELEASE_VERSION}/
* Helm Chart repo: https://charts.projectnessie.org/

Expand Down
28 changes: 12 additions & 16 deletions .github/workflows/snapshot-publish.yml
Expand Up @@ -38,22 +38,18 @@ jobs:
publishToSonatype closeAndReleaseSonatypeStagingRepository
-Prelease -Puber-jar

- name: Gradle / build Docker container
uses: gradle/gradle-build-action@v2
with:
arguments: |
--no-daemon
:nessie-quarkus:quarkusBuild
-Pnative
-Pdocker

- name: Push Docker images
- name: Docker images publishing
env:
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
ARTIFACTS: ../build-artifacts
run: |
rm -rf "${ARTIFACTS}"
mkdir -p "${ARTIFACTS}"

echo '${{ secrets.DOCKER_TOKEN }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin
docker images --filter 'reference=projectnessie/nessie' --format '{{.ID}}\t{{.Tag}}' |
while read IMAGE_ID IMAGE_TAG; do
docker tag "$IMAGE_ID" "projectnessie/nessie-unstable:${IMAGE_TAG%-snapshot}"
docker push "projectnessie/nessie-unstable:${IMAGE_TAG%-snapshot}"
done
tools/dockerbuild/build-push-images.sh \
-a "${ARTIFACTS}" \
-g ":nessie-quarkus" \
-p "servers/quarkus-server" \
-n \
projectnessie/nessie-unstable
rm -rf "${ARTIFACTS}"
19 changes: 0 additions & 19 deletions servers/lambda/build.gradle.kts
Expand Up @@ -54,19 +54,7 @@ dependencies {

buildForJava11()

val useDocker = project.hasProperty("docker")
val useNative = project.hasProperty("native")
var jibPlatforms: String = System.getProperty("quarkus.jib.platforms", "linux/amd64")

if (useNative && jibPlatforms.contains(',')) {
val single = jibPlatforms.substring(0, jibPlatforms.indexOf(','))
logger.warn(
"ONLY building for plaform '{}' instead of '{}', because native image build is enabled.",
single,
jibPlatforms
)
jibPlatforms = single
}

quarkus {
quarkusBuildProperties.put("quarkus.package.type", quarkusPackageType())
Expand All @@ -75,12 +63,6 @@ quarkus {
libs.versions.quarkusNativeBuilderImage.get()
)
quarkusBuildProperties.put("quarkus.native.container-build", useNative.toString())
quarkusBuildProperties.put("quarkus.container-image.build", useDocker.toString())
quarkusBuildProperties.put(
"quarkus.jib.base-jvm-image",
libs.versions.quarkusJibBaseJvmImage.get()
)
quarkusBuildProperties.put("quarkus.jib.platforms", jibPlatforms)
}

val quarkusBuild by
Expand All @@ -98,7 +80,6 @@ tasks.withType<Test>().configureEach {
systemProperty("quarkus.log.console.level", testLogLevel())
systemProperty("http.access.log.level", testLogLevel())
systemProperty("native.image.path", quarkusBuild.nativeRunner)
systemProperty("quarkus.container-image.build", useDocker)
systemProperty("quarkus.smallrye.jwt.enabled", "true")

val testHeapSize: String? by project
Expand Down
22 changes: 0 additions & 22 deletions servers/quarkus-server/build.gradle.kts
Expand Up @@ -60,7 +60,6 @@ dependencies {
implementation("io.quarkus:quarkus-micrometer")
implementation("io.quarkus:quarkus-core-deployment")
implementation(libs.quarkus.opentelemetry)
implementation("io.quarkus:quarkus-container-image-jib")
implementation(libs.quarkus.logging.sentry)
implementation("io.smallrye:smallrye-open-api-jaxrs")
implementation("io.micrometer:micrometer-registry-prometheus")
Expand Down Expand Up @@ -114,34 +113,14 @@ val pullOpenApiSpec by
}

val openApiSpecDir = buildDir.resolve("openapi-extra")
val useDocker = project.hasProperty("docker")
val useNative = project.hasProperty("native")
var jibPlatforms: String = System.getProperty("quarkus.jib.platforms", "linux/amd64")

if (useNative && jibPlatforms.contains(',')) {
val single = jibPlatforms.substring(0, jibPlatforms.indexOf(','))
logger.warn(
"ONLY building for plaform '{}' instead of '{}', because native image build is enabled.",
single,
jibPlatforms
)
jibPlatforms = single
}

quarkus {
quarkusBuildProperties.put("quarkus.package.type", quarkusPackageType())
quarkusBuildProperties.put(
"quarkus.native.builder-image",
libs.versions.quarkusNativeBuilderImage.get()
)
quarkusBuildProperties.put("quarkus.native.container-build", useNative.toString())
quarkusBuildProperties.put("quarkus.container-image.build", useDocker.toString())
quarkusBuildProperties.put("quarkus.container-image.builder", "jib")
quarkusBuildProperties.put(
"quarkus.jib.base-jvm-image",
libs.versions.quarkusJibBaseJvmImage.get()
)
quarkusBuildProperties.put("quarkus.jib.platforms", jibPlatforms)
quarkusBuildProperties.put(
"quarkus.smallrye-openapi.store-schema-directory",
buildDir.resolve("openapi").toString()
Expand Down Expand Up @@ -202,7 +181,6 @@ tasks.withType<Test>().configureEach {
if (project.hasProperty("native")) {
systemProperty("native.image.path", quarkusBuild.get().nativeRunner)
}
systemProperty("quarkus.container-image.build", useDocker)
systemProperty("quarkus.smallrye.jwt.enabled", "true")
systemProperty(
"it.nessie.container.postgres.tag",
Expand Down
Expand Up @@ -163,11 +163,6 @@ quarkus.native.additional-build-args=\
-J-Dfile.encoding=UTF-8,\
--enable-monitoring

## quarkus container specific settings
# fixed at buildtime
quarkus.container-image.group=projectnessie
quarkus.container-image.name=nessie

# Metrics collection settings
quarkus.micrometer.enabled=true
quarkus.micrometer.export.prometheus.enabled=true
Expand Down