Skip to content

Commit

Permalink
Add registry login for portable AOT tests (#4883)
Browse files Browse the repository at this point in the history
- Add registry login for portable AOT tests to avoid pull limit

Signed-off-by: LongyuZhang <[email protected]>
  • Loading branch information
LongyuZhang authored Nov 23, 2023
1 parent 90fa906 commit 546fc0d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 17 deletions.
24 changes: 23 additions & 1 deletion external/aot/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,29 @@
<mkdir dir="${DEST}"/>
</target>

<target name="dist" depends="move_scripts,clean_image" description="generate the distribution">
<target name="prepare_base_image" depends="move_scripts,clean_image" description="prepare the base image">
<echo message="Executing external.sh --prepare --dir ${TEST} --tag ${dockerImageTag} --version ${JDK_VERSION} --impl ${JDK_IMPL} --base_docker_registry_url 'docker.io' --base_docker_registry_dir 'default' --docker_args ${extra_docker_args} " />
<exec executable="bash" failonerror="true">
<arg value="${DEST_EXTERNAL}/external.sh"/>
<arg value="--prepare"/>
<arg value="--dir"/>
<arg value="${TEST}"/>
<arg value="--tag"/>
<arg value="${dockerImageTag}"/>
<arg value="--version"/>
<arg value="${JDK_VERSION}"/>
<arg value="--impl"/>
<arg value="${JDK_IMPL}"/>
<arg value="--base_docker_registry_url"/>
<arg value="docker.io"/>
<arg value="--base_docker_registry_dir"/>
<arg value="default"/>
<arg value="--docker_args"/>
<arg value="${extra_docker_args}"/>
</exec>
</target>

<target name="dist" depends="prepare_base_image" description="generate the distribution">
<copy todir="${DEST}">
<fileset dir="${src}" includes="*.xml, *.mk, *.sh"/>
</copy>
Expand Down
6 changes: 0 additions & 6 deletions external/aot/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
$(TEST_STATUS); \
$(TEST_ROOT)$(D)external$(D)external.sh --clean --tag "${DOCKERIMAGE_TAG}" --dir aot --platform "${PLATFORM}" --node_labels "${NODE_LABELS}"
</command>
<disables>
<disable>
<comment>Disable until next release https://github.com/eclipse-openj9/openj9/pull/15812#issuecomment-1235566485</comment>
<platform>aarch64_linux</platform>
</disable>
</disables>
<features>
<feature>AOT:applicable</feature>
</features>
Expand Down
25 changes: 15 additions & 10 deletions external/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,16 @@ parseCommandLineArgs "$@"
if [ $command_type == "prepare" ]; then
# Specify docker.io or internal registry to prepare base image with login to increase pull limit or authenticate; Redhat Registry no login.
if [[ $base_docker_registry_url != "default" ]]; then
echo "Base Docker Registry login starts to obtain Base Docker Image:"
# Temporarily criu-ubi image with criu binary is only available internally
if [[ "${test}" != *"criu-ubi"* ]]; then
echo $BASE_DOCKER_REGISTRY_CREDENTIAL_PSW | $container_login --username=$BASE_DOCKER_REGISTRY_CREDENTIAL_USR --password-stdin $base_docker_registry_url
else
echo $DOCKER_REGISTRY_CREDENTIALS_PSW | $container_login --username=$DOCKER_REGISTRY_CREDENTIALS_USR --password-stdin $base_docker_registry_url
# Container credential check. Temporarily criu-ubi image with criu binary is only available internally
if [[ ! -z $BASE_DOCKER_REGISTRY_CREDENTIAL_USR || ! -z $DOCKER_REGISTRY_CREDENTIALS_USR ]]; then
echo "Base Docker Registry login starts to obtain Base Docker Image:"
if [[ "${test}" != *"criu-ubi"* ]]; then
echo $BASE_DOCKER_REGISTRY_CREDENTIAL_PSW | $container_login --username=$BASE_DOCKER_REGISTRY_CREDENTIAL_USR --password-stdin $base_docker_registry_url
else
echo $DOCKER_REGISTRY_CREDENTIALS_PSW | $container_login --username=$DOCKER_REGISTRY_CREDENTIALS_USR --password-stdin $base_docker_registry_url
fi
else
echo "No credential available for container registry, will proceed without login..."
fi

if [[ $base_docker_registry_dir == "default" ]]; then
Expand All @@ -305,7 +309,9 @@ if [ $command_type == "prepare" ]; then
echo "$container_pull $base_docker_registry_url/$base_docker_image_name"
$container_pull $base_docker_registry_url/$base_docker_image_name

$container_logout $base_docker_registry_url
if [[ ! -z $BASE_DOCKER_REGISTRY_CREDENTIAL_USR || ! -z $DOCKER_REGISTRY_CREDENTIALS_USR ]]; then
$container_logout $base_docker_registry_url
fi
fi
fi

Expand Down Expand Up @@ -409,11 +415,10 @@ if [ $command_type == "load" ]; then
exit 1
fi
else # no need private docker registry
docker_image_name="eclipse-temurin:${JDK_VERSION}-jdk"
docker_image_name="docker.io/library/eclipse-temurin:${JDK_VERSION}-jdk"
if [[ "${JDK_IMPL}" == *"openj9"* ]]; then
docker_image_name="ibm-semeru-runtimes:open-${JDK_VERSION}-jdk"
docker_image_name="docker.io/library/ibm-semeru-runtimes:open-${JDK_VERSION}-jdk"
fi
$container_pull $docker_image_name
test_script_path="$test_root/external/$test/test.sh"
chmod a+x $test_script_path
mount_test_script="-v $test_script_path:/test.sh"
Expand Down

0 comments on commit 546fc0d

Please sign in to comment.