diff --git a/.cloudbuild/cloudbuild-test-c.yaml b/.cloudbuild/cloudbuild-test-c.yaml new file mode 100644 index 00000000..d97e3d6e --- /dev/null +++ b/.cloudbuild/cloudbuild-test-c.yaml @@ -0,0 +1,36 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +timeout: 7200s # 2 hours +substitutions: + _JAVA_SHARED_CONFIG_VERSION: '1.15.1' # {x-version-update:google-cloud-shared-config:current} + +steps: + # GraalVM C build + - name: gcr.io/cloud-builders/docker + args: ["build", "-t", "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_c:${_JAVA_SHARED_CONFIG_VERSION}", "--file", "graalvm-c.Dockerfile", "."] + dir: .cloudbuild + id: graalvm-c-build + waitFor: ["-"] + - name: gcr.io/gcp-runtimes/structure_test + args: + ["-i", "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_c:${_JAVA_SHARED_CONFIG_VERSION}", "--config", ".cloudbuild/graalvm-c.yaml", "-v"] + waitFor: ["graalvm-c-build"] + - name: us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_c:${_JAVA_SHARED_CONFIG_VERSION} + entrypoint: bash + args: [ './.kokoro/presubmit/downstream-build.sh' ] + waitFor: [ "graalvm-c-build" ] + +options: + logging: CLOUD_LOGGING_ONLY diff --git a/.cloudbuild/cloudbuild.yaml b/.cloudbuild/cloudbuild.yaml index 2d597637..30389dc9 100644 --- a/.cloudbuild/cloudbuild.yaml +++ b/.cloudbuild/cloudbuild.yaml @@ -15,39 +15,55 @@ timeout: 7200s # 2 hours substitutions: _JAVA_SHARED_CONFIG_VERSION: '1.15.1' # {x-version-update:google-cloud-shared-config:current} + _IMAGE_REPOSITORY: us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing + _COMMIT_HASH_TAG: infrastructure-public-image-$SHORT_SHA steps: # GraalVM A build - name: gcr.io/cloud-builders/docker args: ["build", - "-t", "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}", - "-t", "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_a:infrastructure-public-image-$SHORT_SHA", + "-t", "${_IMAGE_REPOSITORY}/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}", + "-t", "${_IMAGE_REPOSITORY}/graalvm_a:${_COMMIT_HASH_TAG}", "--file", "graalvm-a.Dockerfile", "."] dir: .cloudbuild id: graalvm-a-build waitFor: ["-"] - name: gcr.io/gcp-runtimes/structure_test args: - ["-i", "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}", "--config", ".cloudbuild/graalvm-a.yaml", "-v"] + ["-i", "${_IMAGE_REPOSITORY}/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}", "--config", ".cloudbuild/graalvm-a.yaml", "-v"] waitFor: ["graalvm-a-build"] # GraalVM B build - name: gcr.io/cloud-builders/docker - args: [ "build", "-t", "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}", - "-t", "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:infrastructure-public-image-$SHORT_SHA", + args: [ "build", "-t", "${_IMAGE_REPOSITORY}/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}", + "-t", "${_IMAGE_REPOSITORY}/graalvm_b:${_COMMIT_HASH_TAG}", "--file", "graalvm-b.Dockerfile", "." ] dir: .cloudbuild id: graalvm-b-build waitFor: [ "-" ] - name: gcr.io/gcp-runtimes/structure_test args: - [ "-i", "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}", "--config", ".cloudbuild/graalvm-b.yaml", "-v" ] + [ "-i", "${_IMAGE_REPOSITORY}/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}", "--config", ".cloudbuild/graalvm-b.yaml", "-v" ] waitFor: [ "graalvm-b-build" ] + # GraalVM C build + - name: gcr.io/cloud-builders/docker + args: [ "build", "-t", "${_IMAGE_REPOSITORY}/graalvm_c:${_JAVA_SHARED_CONFIG_VERSION}", + "-t", "${_IMAGE_REPOSITORY}/graalvm_c:${_COMMIT_HASH_TAG}", + "--file", "graalvm-c.Dockerfile", "." ] + dir: .cloudbuild + id: graalvm-c-build + waitFor: [ "-" ] + - name: gcr.io/gcp-runtimes/structure_test + args: + [ "-i", "${_IMAGE_REPOSITORY}/graalvm_c:${_JAVA_SHARED_CONFIG_VERSION}", "--config", ".cloudbuild/graalvm-c.yaml", "-v" ] + waitFor: [ "graalvm-c-build" ] options: logging: CLOUD_LOGGING_ONLY images: - - us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION} - - us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION} - - us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_a:infrastructure-public-image-$SHORT_SHA - - us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:infrastructure-public-image-$SHORT_SHA + - ${_IMAGE_REPOSITORY}/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION} + - ${_IMAGE_REPOSITORY}/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION} + - ${_IMAGE_REPOSITORY}/graalvm_c:${_JAVA_SHARED_CONFIG_VERSION} + - ${_IMAGE_REPOSITORY}/graalvm_a:${_COMMIT_HASH_TAG} + - ${_IMAGE_REPOSITORY}/graalvm_b:${_COMMIT_HASH_TAG} + - ${_IMAGE_REPOSITORY}/graalvm_c:${_COMMIT_HASH_TAG} diff --git a/.cloudbuild/graalvm-c.Dockerfile b/.cloudbuild/graalvm-c.Dockerfile new file mode 100644 index 00000000..11686b3c --- /dev/null +++ b/.cloudbuild/graalvm-c.Dockerfile @@ -0,0 +1,49 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM ghcr.io/graalvm/graalvm-community:17.0.9-ol9-20231024 + +# use microdnf, see https://github.com/graalvm/container/issues/10 +RUN microdnf update -y oraclelinux-release-el9 && \ + microdnf install -y wget unzip git && \ + # Install maven + wget -q https://archive.apache.org/dist/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.zip -O /tmp/maven.zip && \ + unzip /tmp/maven.zip -d /tmp/maven && \ + mv /tmp/maven/apache-maven-3.9.4 /usr/local/lib/maven && \ + rm /tmp/maven.zip && \ + ln -s $JAVA_HOME/lib $JAVA_HOME/conf + +ENV PATH $PATH:/usr/local/lib/maven/bin + +# Install gcloud SDK +COPY google-cloud-sdk.repo /etc/yum.repos.d/google-cloud-sdk.repo +RUN microdnf install -y google-cloud-sdk + +# Adding the package path to local +ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin + +# Install docker +# See also https://docs.docker.com/engine/install/rhel/#set-up-the-repository +COPY docker-ce.repo /etc/yum.repos.d/docker-ce.repo +RUN microdnf install -y docker-ce docker-ce-cli + +# Install terraform +# See also https://www.hashicorp.com/official-packaging-guide +COPY hashicorp.repo /etc/yum.repos.d/hashicorp.repo +RUN microdnf -y install terraform + +# Install jq +RUN microdnf -y install jq + +WORKDIR /workspace diff --git a/.cloudbuild/graalvm-c.yaml b/.cloudbuild/graalvm-c.yaml new file mode 100644 index 00000000..b2081c0f --- /dev/null +++ b/.cloudbuild/graalvm-c.yaml @@ -0,0 +1,29 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +schemaVersion: 1.0.0 +commandTests: + - name: "version" + command: ["java", "-version"] + # java -version outputs to stderr... + expectedError: ["openjdk version \"17.0.9\"", "GraalVM CE 17.0.9"] + - name: "maven" + command: ["mvn", "-version"] + expectedOutput: ["Apache Maven 3.9.4"] + - name: "gcloud" + command: ["gcloud", "version"] + expectedOutput: ["Google Cloud SDK"] + - name: "docker" + command: ["docker", "--version"] + expectedOutput: ["Docker version *"]