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 .kokoro/docker/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: .kokoro/docker
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", ".kokoro/docker/${_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: .kokoro/docker
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", ".kokoro/docker/${_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"]
63 changes: 63 additions & 0 deletions .kokoro/docker/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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", "."]
env:
dir: .kokoro/docker
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", ".kokoro/docker/${_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: .kokoro/docker
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", ".kokoro/docker/${_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" ]
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}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@suztomo Wanted to call out these publishing destinations. We're publishing to gcr.io/cloud-devrel-kokoro-resources/ which will be used by our kokoro jobs downstream and gcr.io/cloud-devrel-public-resources which is a public repository of images for client library testing.

Copy link
Member

@suztomo suztomo Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need both? Can you write down rationale in source code comments in this YAML file?

Copy link
Contributor Author

@mpeddada1 mpeddada1 Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think gcr.io/cloud-devrel-kokoro-resources is used by Kokoro jobs whereas gcr.io/cloud-devrel-public-resources/ is used for making our testing images public to allow non-Googlers to run tests against the same image as us. I've added this in here following convention in https://github.com/googleapis/testing-infra-docker. We seem to publish images to both locations for several other languages as well (nodejs, python). Example: https://github.com/googleapis/testing-infra-docker/blob/f3a27546b3a9fedef75a78f22c8fde23d5c013d3/python/cloudbuild.yaml#L61-L69

8 changes: 8 additions & 0 deletions .kokoro/docker/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 .kokoro/docker/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 .kokoro/docker/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 .kokoro/docker/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 .kokoro/docker/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 *"]