diff --git a/.github/workflows/cve-scan.yml b/.github/workflows/cve-scan.yml index 043d2378bd43..ee0c41308df6 100644 --- a/.github/workflows/cve-scan.yml +++ b/.github/workflows/cve-scan.yml @@ -166,9 +166,10 @@ jobs: scan-path: flink/v2.1/flink-runtime/build/libs unpack: false - distribution: open-api-test-fixtures-runtime - build-task: :iceberg-open-api:shadowJar - scan-path: open-api/build/libs + build-task: :iceberg-open-api:stageRESTFixtureRuntime + scan-path: open-api/build/iceberg-rest-server/libs unpack: false + copy-all: true name: ${{ matrix.distribution }} steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -192,6 +193,8 @@ jobs: mkdir -p /tmp/cve-scan if [ "${{ matrix.unpack }}" = "true" ]; then unzip ${{ matrix.scan-path }}/*.zip -d /tmp/cve-scan + elif [ "${{ matrix.copy-all }}" = "true" ]; then + cp ${{ matrix.scan-path }}/*.jar /tmp/cve-scan/ else cp ${{ matrix.scan-path }}/iceberg-${{ matrix.distribution }}-*.jar /tmp/cve-scan/ fi diff --git a/.github/workflows/publish-iceberg-rest-fixture-docker.yml b/.github/workflows/publish-iceberg-rest-fixture-docker.yml index 71e6c68b07e5..3622f14870b5 100644 --- a/.github/workflows/publish-iceberg-rest-fixture-docker.yml +++ b/.github/workflows/publish-iceberg-rest-fixture-docker.yml @@ -52,8 +52,8 @@ jobs: with: # Read-only: small job; restore opportunistically from other jobs' caches but never write. cache-read-only: true - - name: Build Iceberg Open API project - run: ./gradlew :iceberg-open-api:shadowJar + - name: Stage REST fixture image classpath + run: ./gradlew :iceberg-open-api:stageRESTFixtureRuntime - name: Login to Docker Hub env: DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} diff --git a/build.gradle b/build.gradle index 01e282ecf9dd..ec038929f4f1 100644 --- a/build.gradle +++ b/build.gradle @@ -1077,9 +1077,6 @@ project(':iceberg-snowflake') { project(':iceberg-open-api') { apply plugin: 'java-test-fixtures' - apply plugin: 'com.gradleup.shadow' - - build.dependsOn shadowJar dependencies { testImplementation project(':iceberg-api') @@ -1164,21 +1161,16 @@ project(':iceberg-open-api') { } check.dependsOn('validateRESTCatalogSpec') - shadowJar { - archiveBaseName.set("iceberg-open-api-test-fixtures-runtime") - archiveClassifier.set(null) - configurations = [project.configurations.testFixturesRuntimeClasspath] - from sourceSets.testFixtures.output - zip64 true - - // include the LICENSE and NOTICE files for the runtime Jar + // REST server runtime as a dir of jars; consumed by docker/iceberg-rest-fixture. + tasks.register('stageRESTFixtureRuntime', Sync) { + into layout.buildDirectory.dir('iceberg-rest-server') from(projectDir) { include 'LICENSE' include 'NOTICE' } - - manifest { - attributes 'Main-Class': 'org.apache.iceberg.rest.RESTCatalogServer' + into('libs') { + from configurations.testFixturesRuntimeClasspath + from tasks.testFixturesJar } } diff --git a/deploy.gradle b/deploy.gradle index 65836bf1b3f1..2a72a7f601e1 100644 --- a/deploy.gradle +++ b/deploy.gradle @@ -54,8 +54,8 @@ subprojects { testArtifacts testJar } - // add LICENSE and NOTICE - [jar, sourceJar, javadocJar, testJar].each { task -> + // add build info, LICENSE, and NOTICE + def addBuildInfoAndLicense = { task -> task.dependsOn rootProject.tasks.buildInfo task.from("${rootDir}/build") { include 'iceberg-build.properties' @@ -65,6 +65,11 @@ subprojects { include 'NOTICE' } } + [jar, sourceJar, javadocJar, testJar].each(addBuildInfoAndLicense) + if (isOpenApi) { + // OpenAPI also publishes testFixturesJar for REST fixture consumers. + addBuildInfoAndLicense(testFixturesJar) + } } publishing { diff --git a/docker/iceberg-rest-fixture/Dockerfile b/docker/iceberg-rest-fixture/Dockerfile index 1f3fc881a1b2..a36f26d3e917 100644 --- a/docker/iceberg-rest-fixture/Dockerfile +++ b/docker/iceberg-rest-fixture/Dockerfile @@ -30,8 +30,8 @@ RUN set -xeu && \ # Working directory for the application WORKDIR /usr/lib/iceberg-rest -# Copy runtime files directly to the target location -COPY --chown=iceberg:iceberg open-api/build/libs/iceberg-open-api-test-fixtures-runtime-*.jar /usr/lib/iceberg-rest/iceberg-rest-adapter.jar +# Copy staged REST fixture runtime, including libs/ and LICENSE/NOTICE +COPY --chown=iceberg:iceberg open-api/build/iceberg-rest-server/ /usr/lib/iceberg-rest/ COPY --chown=iceberg:iceberg docker/iceberg-rest-fixture/entrypoint.sh /usr/lib/iceberg-rest/entrypoint.sh ENV CATALOG_CATALOG__IMPL=org.apache.iceberg.jdbc.JdbcCatalog diff --git a/docker/iceberg-rest-fixture/README.md b/docker/iceberg-rest-fixture/README.md index 928c37fe38dd..5e8734facfe3 100644 --- a/docker/iceberg-rest-fixture/README.md +++ b/docker/iceberg-rest-fixture/README.md @@ -86,7 +86,7 @@ When making changes to the local files and test them out, you can build the imag ```bash # Build the project from iceberg root directory -./gradlew :iceberg-open-api:shadowJar +./gradlew :iceberg-open-api:stageRESTFixtureRuntime # Rebuild the docker image docker image rm -f apache/iceberg-rest-fixture && docker build -t apache/iceberg-rest-fixture -f docker/iceberg-rest-fixture/Dockerfile . diff --git a/docker/iceberg-rest-fixture/entrypoint.sh b/docker/iceberg-rest-fixture/entrypoint.sh index 052bd7b7229b..29d9cdc895b8 100644 --- a/docker/iceberg-rest-fixture/entrypoint.sh +++ b/docker/iceberg-rest-fixture/entrypoint.sh @@ -20,7 +20,8 @@ set -eu -CLASSPATH="iceberg-rest-adapter.jar" +# The staged runtime puts all REST server jars under libs/; Java expands this wildcard. +CLASSPATH="libs/*" if [ -n "${LOG_CONFIG_DIR:-}" ]; then CLASSPATH="${LOG_CONFIG_DIR}:${CLASSPATH}"