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

Fix stf sha issue #2913

Merged
merged 23 commits into from
Oct 1, 2021
Merged
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 32 additions & 15 deletions system/common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
</exec>

<echo message="git rev-parse ${stf_branch} "/>
<exec executable="git" failonerror="false" dir="${SYSTEMTEST_ROOT}/stf" outputproperty="stf_sha" resultproperty="code">
<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="false" dir="${SYSTEMTEST_ROOT}/stf" outputproperty="stf_sha" resultproperty="code2">
<exec executable="git" failonerror="false" dir="${SYSTEMTEST_ROOT}/stf" outputproperty="stf_sha2" resultproperty="code2">
<arg value="rev-parse"/>
<arg value="origin/${stf_branch}"/>
</exec>
Expand All @@ -75,21 +75,37 @@
<echo message="This branch does not exist!"/>
</then>
</if>
<if>
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of if, should this be else block? Also, I would like to have git checkout logic once.
pseudocode:

run git rev-parse ${stf_branch} // failonerror="false" and get stf_sha1
If code=128 {
    git rev-parse origin/${stf_branch} // set failonerror="true" and set stf_sha2
     if code2 =128 {
           // error. fail the build. if set failonerror="true" works as expected, we do not need this if block
      } else {
          // success. Set stf_sha
         <property stf_sha value="${stf_sha2}"/>
      }
}
if  stf_sha is not set {
      // set it to stf_sha1
      <property stf_sha value="${stf_sha1}"/>
}
run git checkout -q -f ${stf_sha}

Copy link
Contributor Author

@xius666 xius666 Sep 30, 2021

Choose a reason for hiding this comment

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

I changed the logic according to the pseudocode, it is indeed a cleaner approach, and I also rerun on the grinder(1514,1515,1516).

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks a lot, @xius666 !

<isset property="stf_sha2"/>
<then>
<echo message="git checkout -q -f ${stf_sha2} "/>
<exec executable="git" failonerror="true" dir="${SYSTEMTEST_ROOT}/stf" >
<arg value="checkout"/>
<arg value="-q"/>
<arg value="-f"/>
<arg value="${stf_sha2}"/>
</exec>
</then>
</if>
</then>
<else>
<if>
<isset property="stf_sha1"/>
<then>
<echo message="git checkout -q -f ${stf_sha1} "/>
<exec executable="git" failonerror="true" dir="${SYSTEMTEST_ROOT}/stf" >
<arg value="checkout"/>
<arg value="-q"/>
<arg value="-f"/>
<arg value="${stf_sha1}"/>
</exec>
</then>
</if>
</else>
</if>

<if>
<isset property="stf_sha"/>
<then>
<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>
</then>
</if>



<if>
<isset property="isZOS" />
Expand All @@ -114,7 +130,7 @@
</if>
<checkGitRepoSha repoDir="${SYSTEMTEST_ROOT}/stf" />
</target>

<target name="clone_systemtest">
<echo message="Cloning from: ${openjdk_systemtest_repo} -b ${openjdk_systemtest_branch}"/>
<exec executable="git" failonerror="false" dir="${SYSTEMTEST_ROOT}">
Expand Down Expand Up @@ -184,6 +200,7 @@
<checkGitRepoSha repoDir="${SYSTEMTEST_ROOT}/openj9-systemtest" />
</target>


<target name="check_systemtest" depends="common_init">
<if>
<not>
Expand Down