Skip to content

Commit

Permalink
update gdasapp ci to work with forks, update hera ci PATH (#1173)
Browse files Browse the repository at this point in the history
  • Loading branch information
RussTreadon-NOAA committed Jun 14, 2024
1 parent f4af779 commit 3d77124
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
29 changes: 25 additions & 4 deletions ci/driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,32 @@ repo_url="https://github.com/NOAA-EMC/GDASApp.git"
for pr in $open_pr_list; do
gh pr edit $pr --remove-label $CI_LABEL --add-label ${CI_LABEL}-Running
echo "Processing Pull Request #${pr}"

# get the branch name used for the PR
gdasapp_branch=$(gh pr view $pr --json headRefName -q ".headRefName")

# get the fork information
pr_details=$(gh pr view $pr --repo ${repo_url} --json headRepository,headRepositoryOwner,headRefName)

# extract the necessary info
fork_owner=$(gh pr view $pr --repo ${repo_url} --json headRepositoryOwner --jq '.headRepositoryOwner.login')
fork_name=$(gh pr view $pr --repo ${repo_url} --json headRepository --jq '.headRepository.name')

# construct the fork URL
gdasapp_url="https://github.com/$fork_owner/${fork_name}.git"

echo "Fork URL: $gdasapp_url"
echo "Branch Name: $gdasapp_branch"

# create PR specific directory
if [ -d $GDAS_CI_ROOT/PR/$pr ]; then
rm -rf $GDAS_CI_ROOT/PR/$pr
fi
mkdir -p $GDAS_CI_ROOT/PR/$pr
cd $GDAS_CI_ROOT/PR/$pr

# clone copy of repo
git clone --recursive $repo_url
git clone --recursive --jobs 8 --branch $gdasapp_branch $gdasapp_url
cd GDASApp

# checkout pull request
Expand Down Expand Up @@ -94,11 +115,11 @@ for pr in $open_pr_list; do
# run build and testing command
$my_dir/run_ci.sh -d $GDAS_CI_ROOT/PR/$pr/GDASApp -o $GDAS_CI_ROOT/PR/$pr/output_${commit}
ci_status=$?
gh pr comment $pr --body-file $GDAS_CI_ROOT/PR/$pr/output_${commit}
gh pr comment $pr --repo ${repo_url} --body-file $GDAS_CI_ROOT/PR/$pr/output_${commit}
if [ $ci_status -eq 0 ]; then
gh pr edit $pr --remove-label ${CI_LABEL}-Running --add-label ${CI_LABEL}-Passed
gh pr edit $pr --repo ${repo_url} --remove-label ${CI_LABEL}-Running --add-label ${CI_LABEL}-Passed
else
gh pr edit $pr --remove-label ${CI_LABEL}-Running --add-label ${CI_LABEL}-Failed
gh pr edit $pr --repo ${repo_url} --remove-label ${CI_LABEL}-Running --add-label ${CI_LABEL}-Failed
fi
done

Expand Down
2 changes: 1 addition & 1 deletion ci/hera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export SLURM_ACCOUNT=da-cpu
export SALLOC_ACCOUNT=$SLURM_ACCOUNT
export SBATCH_ACCOUNT=$SLURM_ACCOUNT
export SLURM_QOS=debug
export PATH=$PATH:/scratch1/NCEPDEV/da/role.jedipara/CI/gh/gh_2.46.0_linux_amd64/bin
export PATH=$PATH:/home/role.jedipara/bin

0 comments on commit 3d77124

Please sign in to comment.