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

Script Update to include latest Exclude files for JDK versions #4897

Closed
wants to merge 1 commit into from

Conversation

KapilPowar
Copy link
Contributor

runtimes/backlog/issues/1241

  • Script Update to include latest exclude files from artifactory for JDK versions
    CC: @llxia

@KapilPowar KapilPowar changed the title Update latest Exclude files for JDK versions Script Update to include latest Exclude files for JDK versions Dec 4, 2023
@KapilPowar
Copy link
Contributor Author

Here are the Grinder test runs
JCK_Sync #912 -- Latest exclude file available
JCK_Sync #909 -- Latest exclude file not available
JCK_Sync #913 -- No Exclude file present in Artifactory

buildenv/jenkins/jck_sync Show resolved Hide resolved
jck/jck-semiauto-updater/jckupdater.sh Outdated Show resolved Hide resolved
jck/jck-semiauto-updater/jckupdater.sh Outdated Show resolved Hide resolved
}

getExcludeFiles(){
github_last_modified=$(curl -s -H "Authorization: token $GIT_TOKEN" "https://api.github.ibm.com/repos/runtimes/JCK$JCK_VERSION-unzipped/commits?path=excludes/jck$JCK_FOLDER_SUFFIX.jtx" | awk -F'"date":' '{if(NF>1){gsub(/[",]/,"",$2); print $2; exit}}')
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Please do not hardcode a specific repo
  • It is not limited to one jck$JCK_FOLDER_SUFFIX.jtx. There could be other files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In artifactory material we have only .jtx file in /exc . So we are comparing last modified of .jtx file from Git repo with artifactory material to decide if update is needed or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

The script is also used by other vendors (e.g. Adoptium), not only ibm, so the link repo cannot be hardcoded.

Copy link
Contributor Author

@KapilPowar KapilPowar Dec 19, 2023

Choose a reason for hiding this comment

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

Created a parameter GIT_EXCLUDE_API_URL to provide API url in JCK_Sync job.
JCK_Sync#928

jck/jck-semiauto-updater/jckupdater.sh Outdated Show resolved Hide resolved
jck/jck-semiauto-updater/jckupdater.sh Outdated Show resolved Hide resolved
jck/jck-semiauto-updater/jckupdater.sh Outdated Show resolved Hide resolved
jck/jck-semiauto-updater/jckupdater.sh Outdated Show resolved Hide resolved
@llxia llxia requested a review from LongyuZhang December 4, 2023 19:19
@KapilPowar KapilPowar force-pushed the ExcludeFiles branch 4 times, most recently from 28065f6 to 5aabfa5 Compare December 11, 2023 11:06
@KapilPowar
Copy link
Contributor Author

KapilPowar commented Dec 11, 2023

JCK_Sync #924 -- Latest exclude file not available

JCK_Sync #921 -- Latest exclude file available

JCK_Sync #925 -- No Exclude file present in Artifactory

@KapilPowar KapilPowar requested a review from llxia December 11, 2023 11:46
Copy link
Contributor

@LongyuZhang LongyuZhang left a comment

Choose a reason for hiding this comment

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

Also, when checking this pipeline, the result of 924 and 925 are red, but if the material is already up to date the job should be green.

buildenv/jenkins/jck_sync Show resolved Hide resolved
jck/jck-semiauto-updater/jckupdater.sh Outdated Show resolved Hide resolved
}

getExcludeFiles(){
github_last_modified=$(curl -s -H "Authorization: token $GIT_TOKEN" "https://api.github.ibm.com/repos/runtimes/JCK$JCK_VERSION-unzipped/commits?path=excludes/jck$JCK_FOLDER_SUFFIX.jtx" | awk -F'"date":' '{if(NF>1){gsub(/[",]/,"",$2); print $2; exit}}')
Copy link
Contributor

Choose a reason for hiding this comment

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

The script is also used by other vendors (e.g. Adoptium), not only ibm, so the link repo cannot be hardcoded.

jck/jck-semiauto-updater/jckupdater.sh Outdated Show resolved Hide resolved
@KapilPowar
Copy link
Contributor Author

Also, when checking this pipeline, the result of 924 and 925 are red, but if the material is already up to date the job should be green.

In case of no new update is available, we are using Error condition to break out of flow and marking job as success. This is done as per @llxia suggestion.

@KapilPowar KapilPowar force-pushed the ExcludeFiles branch 2 times, most recently from 80b6a9a to a04569c Compare December 19, 2023 10:44
echo " JCK$JCK_VERSION $JCK_WITHOUT_BACKSLASH is latest and not in the repo $GIT_URL... Please proceed with download"
get_JAVA_SDK
else
if [ $result -ne 0 ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

In this PR, result and exclude_files are global variables and they are used in multiple places. And $result != 0 means we need to update the test material. Similarly, $exclude_files != 0 means we need to update the exclude files. I find it isn't very clear.

Please define boolean parameters isTestMaterialUpdateNeeded and isTestExcludeUpdateNeeded instead.

Copy link
Contributor Author

@KapilPowar KapilPowar Jan 8, 2024

Choose a reason for hiding this comment

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

Using boolean parameters isTestMaterialUpdateNeeded and isTestExcludeUpdateNeeded.
isTestMaterialUpdateNeeded == 0 means we need to update the test material. Using 0 as true and 1 as false.

fi
}

#install Java
get_JAVA_SDK(){
getJavaSDK() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is misleading. The function does get SDK or install java. It just tries to set JAVA_SDK_PATH=$WORKSPACE/../../../../jdkbinary/j2sdk-image if JAVA_HOME does not exist. And JAVA_HOME is a user-provided value.

JAVA_HOME="$1"; shift;;

Please remove this function completely. Instead of

JAVA_HOME="$1"; shift;;
, user can provide JAVA_SDK_PATH. If not, the default is $WORKSPACE/../../../../jdkbinary/j2sdk-image.
Also remove L282 to 287, change it to $JAVA_SDK_PATH/bin/java -jar $f -install shell_scripts -o $WORKSPACE/unpackjck

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes done as per review. Removed get_JAVA_SDK().
$JAVA_SDK_PATH is the default unless user provides value.

jck/jck-semiauto-updater/jckupdater.sh Outdated Show resolved Hide resolved
@KapilPowar
Copy link
Contributor Author

KapilPowar commented Jan 8, 2024

JCK_Sync #939 -- Latest exclude file not available

JCK_Sync #937 -- Latest exclude file available

JCK_Sync #940 -- No Exclude file present in Artifactory

@KapilPowar
Copy link
Contributor Author

Until further notice PR is moved to Draft.

@KapilPowar KapilPowar marked this pull request as draft January 16, 2024 05:40
Update Exclude files

- Update script to include latest exclude files from artifactory for JDK versions

Signed-off-by: Kapil Powar <[email protected]>
@KapilPowar
Copy link
Contributor Author

KapilPowar commented Jan 23, 2024

@KapilPowar KapilPowar marked this pull request as ready for review January 23, 2024 09:02
@KapilPowar
Copy link
Contributor Author

Moved to internal repo. Closing it.

@KapilPowar KapilPowar closed this Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants