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

chore: publish native image docker images from java-shared-config #660

Merged
merged 9 commits into from
Oct 2, 2023
57 changes: 57 additions & 0 deletions .cloudbuild/cloudbuild-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright 2023 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.5.7'
_GRAALVM_A: 'graalvm22_3_jdk11'
_GRAALVM_B: 'graalvm22_3_jdk17'
steps:
# GraalVM A build
- name: gcr.io/cloud-builders/docker
args: ["build", "-t", "gcr.io/$PROJECT_ID/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}", "--file", "${_GRAALVM_A}.Dockerfile", "."]
dir: .cloudbuild
id: graalvm-a-build
waitFor: ["-"]
- name: gcr.io/gcp-runtimes/structure_test
args:
["-i", "gcr.io/$PROJECT_ID/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}", "--config", ".cloudbuild/${_GRAALVM_A}.yaml", "-v"]
waitFor: ["graalvm-a-build"]
- name: gcr.io/cloud-builders/docker
args:
[
"tag",
"gcr.io/$PROJECT_ID/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}",
"gcr.io/cloud-devrel-public-resources/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}",
]
waitFor: ["graalvm-a-build"]

# GraalVM B build
- name: gcr.io/cloud-builders/docker
args: ["build", "-t", "gcr.io/$PROJECT_ID/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}", "--file", "${_GRAALVM_B}.Dockerfile", "."]
dir: .cloudbuild
id: graalvm-b-build
waitFor: ["-"]
- name: gcr.io/gcp-runtimes/structure_test
args:
["-i", "gcr.io/$PROJECT_ID/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}", "--config", ".cloudbuild/${_GRAALVM_B}.yaml", "-v"]
waitFor: ["graalvm-b-build"]
- name: gcr.io/cloud-builders/docker
args:
[
"tag",
"gcr.io/$PROJECT_ID/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}",
"gcr.io/cloud-devrel-public-resources/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}",
]
waitFor: ["graalvm-b-build"]
66 changes: 66 additions & 0 deletions .cloudbuild/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright 2023 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.5.7'
_GRAALVM_A: 'graalvm22_3_jdk11'
_GRAALVM_B: 'graalvm22_3_jdk17'
steps:
# GraalVM A build
- name: gcr.io/cloud-builders/docker
args: ["build", "-t", "gcr.io/$PROJECT_ID/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}", "--file", "${_GRAALVM_A}.Dockerfile", "."]
dir: .cloudbuild
id: graalvm-a-build
waitFor: ["-"]
- name: gcr.io/gcp-runtimes/structure_test
args:
["-i", "gcr.io/$PROJECT_ID/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}", "--config", ".cloudbuild/${_GRAALVM_A}.yaml", "-v"]
waitFor: ["graalvm-a-build"]
- name: gcr.io/cloud-builders/docker
args:
[
"tag",
"gcr.io/$PROJECT_ID/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}",
"gcr.io/cloud-devrel-public-resources/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}",
]
waitFor: ["graalvm-a-build"]

# GraalVM B build
- name: gcr.io/cloud-builders/docker
args: [ "build", "-t", "gcr.io/$PROJECT_ID/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}", "--file", "${_GRAALVM_B}.Dockerfile", "." ]
dir: .cloudbuild
id: graalvm-b-build
waitFor: [ "-" ]
- name: gcr.io/gcp-runtimes/structure_test
args:
[ "-i", "gcr.io/$PROJECT_ID/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}", "--config", ".cloudbuild/${_GRAALVM_B}.yaml", "-v" ]
waitFor: [ "graalvm-b-build" ]
- name: gcr.io/cloud-builders/docker
args:
[
"tag",
"gcr.io/$PROJECT_ID/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}",
"gcr.io/cloud-devrel-public-resources/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}",
]
waitFor: [ "graalvm-b-build" ]

# The docker images will be published to GCP projects cloud-devrel-kokoro-resources and cloud-devrel-public-resources
# following convention in https://github.com/googleapis/testing-infra-docker. While the former will be used for Kokoro
mpeddada1 marked this conversation as resolved.
Show resolved Hide resolved
# jobs in the downstream repos, the latter makes the docker images publicly available for testing.
images:
- gcr.io/$PROJECT_ID/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}
- gcr.io/cloud-devrel-public-resources/graalvm_a:${_JAVA_SHARED_CONFIG_VERSION}
- gcr.io/$PROJECT_ID/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}
- gcr.io/cloud-devrel-public-resources/graalvm_b:${_JAVA_SHARED_CONFIG_VERSION}
8 changes: 8 additions & 0 deletions .cloudbuild/google-cloud-sdk.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
45 changes: 45 additions & 0 deletions .cloudbuild/graalvm22_3_jdk11.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2023 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-ce:ol7-java11-22.3.2-b1

RUN gu install native-image && \
yum update -y && \
yum 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 yum install -y google-cloud-sdk

# Adding the package path to local
ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin

# Install docker
RUN yum install -y docker-engine docker-cli

# Install terraform
RUN yum -y install terraform

# Install jq
RUN yum -y install jq

WORKDIR /workspace
29 changes: 29 additions & 0 deletions .cloudbuild/graalvm22_3_jdk11.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2023 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 \"11.0.19\"", "GraalVM CE 22.3.2"]
- 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 *"]
45 changes: 45 additions & 0 deletions .cloudbuild/graalvm22_3_jdk17.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2023 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-ce:ol7-java17-22.3.2-b1

RUN gu install native-image && \
yum update -y && \
yum 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 yum install -y google-cloud-sdk

# Adding the package path to local
ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin

# Install docker
RUN yum install -y docker-engine docker-cli

# Install terraform
RUN yum -y install terraform

# Install jq
RUN yum -y install jq

WORKDIR /workspace
29 changes: 29 additions & 0 deletions .cloudbuild/graalvm22_3_jdk17.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2023 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.7\"", "GraalVM CE 22.3.2"]
- 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 *"]