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

Add Optional Additional Artifact Contents #67

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
21 changes: 21 additions & 0 deletions .github/workflows/config-pr-1-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@ on:
# - doc/**
# - .*
# - README.md
inputs:
additional-artifact-content-paths:
type: string
required: false
# For example, the value of 'checksum' will expand to something like
# '/scratch/tm70/repro-ci/experiments/MODEL-configs/dev-CONFIG/checksum'
# on the remote.
description: |
Newline-separated paths for inclusion in the release artifact.
Note that all paths given have 'env.EXPERIMENT_LOCATION/' prepended.
outputs:
repro-ci-artifact-name:
value: ${{ jobs.repro-ci.outputs.artifact-name }}
description: Name of the repro-ci artifact
repro-ci-artifact-url:
value: ${{ jobs.repro-ci.outputs.artifact-url }}
description: URL to the repro-ci artifact
repro-ci-experiment-location:
value: ${{ jobs.repro-ci.outputs.experiment-location }}
description: Location of the experiment on the target environment
jobs:
commit-check:
name: Commit Check
Expand Down Expand Up @@ -206,6 +226,7 @@ jobs:
test-markers: ${{ needs.config.outputs.repro-markers }}
model-config-tests-version: ${{ needs.config.outputs.repro-model-config-tests-version }}
payu-version: ${{ needs.config.outputs.repro-payu-version }}
additional-artifact-content-paths: ${{ inputs.additional-artifact-content-paths }}
secrets: inherit
permissions:
contents: write
Expand Down
32 changes: 27 additions & 5 deletions .github/workflows/test-repro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ on:
type: string
required: true
description: The payu module version used to create test virtual environment
additional-artifact-content-paths:
type: string
required: false
# For example, the value of 'checksum' will expand to something like
# '/scratch/tm70/repro-ci/experiments/MODEL-configs/dev-CONFIG/checksum'
# on the remote.
description: |
Newline-separated paths for inclusion in the release artifact.
Note that all paths given have 'env.EXPERIMENT_LOCATION/' prepended.
outputs:
artifact-name:
value: ${{ jobs.repro.outputs.artifact-name }}
Expand All @@ -37,7 +46,7 @@ on:
value: ${{ jobs.repro.outputs.experiment-location }}
description: Location of the experiment on the target environment
env:
TEST_OUTPUT_LOCAL_LOCATION: /opt/test-output
ARTIFACT_LOCAL_LOCATION: /opt/artifact
CodeGat marked this conversation as resolved.
Show resolved Hide resolved
jobs:
repro:
# NOTE: A lot of these `vars` and `secrets` are not found in this repository. Instead, they are inherited
Expand Down Expand Up @@ -137,9 +146,22 @@ jobs:

- name: Copy Back Checksums and Test Report
run: |
rsync --recursive -e 'ssh -i ${{ steps.ssh.outputs.private-key-path }}' \
'${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST_DATA }}:${{ env.EXPERIMENT_LOCATION }}/checksum' \
${{ env.TEST_OUTPUT_LOCAL_LOCATION }}
rsync --recursive --verbose -e 'ssh -i ${{ steps.ssh.outputs.private-key-path }}' \
'${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST_DATA }}:${{ env.EXPERIMENT_LOCATION }}/checksum' \
${{ env.ARTIFACT_LOCAL_LOCATION }}

- name: Copy Back Additional Artifact Content
if: inputs.additional-artifact-content-paths != ''
# For each of the additional artifact content paths, rsync the data
# from the target into our runner for upload as an artifact
run: |
while IFS= read -r content_path; do
if [[ -n "$content_path" ]]; then
rsync --recursive --relative --verbose -e 'ssh -i ${{ steps.ssh.outputs.private-key-path }}' \
"${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST_DATA }}:${{ env.EXPERIMENT_LOCATION }}/./$content_path" \
${{ env.ARTIFACT_LOCAL_LOCATION }}
fi
done <<< "${{ inputs.additional-artifact-content-paths }}"

- name: Generate Test Output Artifact Name
id: artifact
Expand All @@ -151,4 +173,4 @@ jobs:
with:
name: ${{ steps.artifact.outputs.name }}
if-no-files-found: error
path: ${{ env.TEST_OUTPUT_LOCAL_LOCATION }}
path: ${{ env.ARTIFACT_LOCAL_LOCATION }}