Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Create a common function for git clone test related repos #5288

Open
llxia opened this issue May 7, 2024 · 0 comments
Open

Create a common function for git clone test related repos #5288

llxia opened this issue May 7, 2024 · 0 comments

Comments

@llxia
Copy link
Contributor

llxia commented May 7, 2024

In system tests and openjdk tests repos, we need to git clone and track repo sha.

<getFileWithRetry file="STF" command="git clone -q ${stf_repo}" dest="${SYSTEMTEST_ROOT}"/>
<echo message="git rev-parse ${stf_branch} "/>
<exec executable="git" failonerror="false" dir="${SYSTEMTEST_ROOT}/STF" outputproperty="stf_sha1" resultproperty="code">
<arg value="rev-parse"/>
<arg value="${stf_branch}"/>
</exec>
<if>
<equals arg1="${code}" arg2="128"/>
<then>
<echo message="git rev-parse origin/${stf_branch}"/>
<exec executable="git" failonerror="true" dir="${SYSTEMTEST_ROOT}/STF" outputproperty="stf_sha2" resultproperty="code2">
<arg value="rev-parse"/>
<arg value="origin/${stf_branch}"/>
</exec>
<property name="stf_sha" value="${stf_sha2}"/>
</then>
</if>
<if>
<not>
<isset property="stf_sha"/>
</not>
<then>
<property name="stf_sha" value="${stf_sha1}"/>
</then>
</if>
<if>
<isset property="isZOS" />
<then>
<propertyregex
property="stf_sha"
input="${stf_sha}"
regexp="\n"
replace=""
override="true"/>
</then>
</if>
<echo message="git checkout -q -f ${stf_sha} "/>
<exec executable="git" failonerror="true" dir="${SYSTEMTEST_ROOT}/STF" >
<arg value="checkout"/>
<arg value="-q"/>
<arg value="-f"/>
<arg value="${stf_sha}"/>
</exec>

<getFileWithRetry file="openjdktemp" command="git clone --depth 1 -q ${REFERENCE_REPO} -b ${env.JDK_BRANCH} ${JDK_REPO_SPECIFIC} openjdktemp"/>
<if>
<equals arg1="${failCode}" arg2="128"/>
<then>
<getFileWithRetry file="openjdktemp" command="git clone -q ${JDK_REPO_SPECIFIC} openjdktemp"/>
<echo message="git rev-parse ${env.JDK_BRANCH} "/>
<exec executable="git" failonerror="false" dir="openjdktemp" outputproperty="jdk_sha1" resultproperty="code">
<arg value="rev-parse"/>
<arg value="${env.JDK_BRANCH}"/>
</exec>
<if>
<equals arg1="${code}" arg2="128"/>
<then>
<echo message="git rev-parse origin/${env.JDK_BRANCH}"/>
<exec executable="git" failonerror="true" dir="openjdktemp" outputproperty="jdk_sha2" resultproperty="code2">
<arg value="rev-parse"/>
<arg value="origin/${env.JDK_BRANCH}"/>
</exec>
<property name="jdk_sha" value="${jdk_sha2}"/>
</then>
</if>
<if>
<not>
<isset property="jdk_sha"/>
</not>
<then>
<property name="jdk_sha" value="${jdk_sha1}"/>
</then>
</if>
<if>
<isset property="isZOS"/>
<then>
<propertyregex property="jdk_sha" input="${jdk_sha}" regexp="\n" replace="" override="true"/>
</then>
</if>
<echo message="git checkout -q -f ${jdk_sha} "/>
<exec executable="git" failonerror="true" dir="openjdktemp">
<arg value="checkout"/>
<arg value="-q"/>
<arg value="-f"/>
<arg value="${jdk_sha}"/>
</exec>
</then>

We should create a common function for this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant