Skip to content

Commit

Permalink
use role.jedipara for hera ci (NOAA-EMC#1173)
Browse files Browse the repository at this point in the history
One task in NOAA-EMC#1150 is to move automated CI to role accounts. This PR
moves Hera CI to role.jedipara.

Fixes NOAA-EMC#1172

---------

Co-authored-by: Guillaume Vernieres <[email protected]>
  • Loading branch information
RussTreadon-NOAA and guillaumevernieres committed Jun 17, 2024
1 parent f5bbec0 commit 0c7b4d1
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 8 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ Global Data Assimilation System Application

The one app to rule them all

## Notes to developers

1 - As a developer, you will have to build the GDASApp againt the `dev/gdasapp` branch of the `global-workflow`

```bash
git clone --recursive --jobs 8 --branch dev/gdasapp https://github.com/NOAA-EMC/global-workflow.git
```

2 - For the most part (boundaries of that terminology is stil TBD), changes to the `global-workflow` related to the `GDASApp` developement will be issued in the `dev/gdasapp` branch.

3 - If your feature development involves changes to the global-workflow and the GDASApp, you will have to issue a PR in each repository. The GDASApp PR will have to have the same name in order for the GDASApp CI to build and run the correct branches.

4 - If your work is contained within the `global-workflow` only, you will have to submit a dummy PR in the `GDASApp` with the same branch name.
To submit a dummy PR, just create a branch with an empty commit:
```
git commit --allow-empty -m "Dummy commit to trigger PR"
```


[![Orion](https://github.com/NOAA-EMC/GDASApp/actions/workflows/orion.yaml/badge.svg)](https://github.com/NOAA-EMC/GDASApp/actions/workflows/orion.yaml)
[![Hera](https://github.com/NOAA-EMC/GDASApp/actions/workflows/hera.yaml/badge.svg)](https://github.com/NOAA-EMC/GDASApp/actions/workflows/hera.yaml)

Expand Down
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
29 changes: 27 additions & 2 deletions ci/gw_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,36 @@ workflow_url="https://github.com/NOAA-EMC/global-workflow.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")

# check for a companion PR in the global-workflow
companion_pr_exists=$(gh pr list --repo ${workflow_url} --head ${gdasapp_branch} --state open)
if [ -n "$companion_pr_exists" ]; then
# get the PR number
companion_pr=$(echo "$companion_pr_exists" | awk '{print $1;}')

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

# Construct the fork URL
workflow_url="https://github.com/$fork_owner/$fork_name.git"

echo "Fork URL: $workflow_url"
echo "Branch Name: $gdasapp_branch"
fi

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

# clone global workflow develop branch
git clone --recursive $workflow_url
git clone --recursive --jobs 8 --branch dev/gdasapp $workflow_url

# checkout pull request
cd $GDAS_CI_ROOT/workflow/PR/$pr/global-workflow/sorc/gdas.cd
Expand Down
4 changes: 2 additions & 2 deletions ci/hera.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export GDAS_CI_ROOT=/scratch1/NCEPDEV/da/Cory.R.Martin/CI/GDASApp
export GDAS_CI_ROOT=/scratch1/NCEPDEV/da/role.jedipara/CI/GDASApp
export GDAS_CI_HOST='hera'
export GDAS_MODULE_USE=$GDAS_CI_ROOT/repo/modulefiles
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/Cory.R.Martin/CI/gh/gh_2.46.0_linux_amd64/bin
export PATH=$PATH:/home/role.jedipara/bin

0 comments on commit 0c7b4d1

Please sign in to comment.