diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-01-16 22:05:53 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-01-16 22:05:53 -0500 |
commit | 8194dba9c99fc676fa309c53a0fdc0faa3b65f52 (patch) | |
tree | 52da1de8140be6f5373c41ad3a14f4463fa6017c /.github | |
parent | 627fa041d632d07d656ef795595abf1eb118a8eb (diff) | |
download | ghasandbox-8194dba9c99fc676fa309c53a0fdc0faa3b65f52.tar.gz |
OK
Diffstat (limited to '.github')
-rw-r--r-- | .github/actions/stasis/action.yml | 236 | ||||
-rw-r--r-- | .github/workflows/pipeline_run.yml | 37 |
2 files changed, 273 insertions, 0 deletions
diff --git a/.github/actions/stasis/action.yml b/.github/actions/stasis/action.yml new file mode 100644 index 0000000..cb72d7c --- /dev/null +++ b/.github/actions/stasis/action.yml @@ -0,0 +1,236 @@ +name: STASIS + +description: | + Executes the STASIS with arguments + +inputs: + prefix: + type: string + description: STASIS installation prefix + required: false + default: "${{ github.workspace }}/.local" + + artifactory_url: + type: string + description: Artifactory base address (without /artifactory) + required: true + default: "" + + artifactory_repo: + type: string + description: Artifactory repository path where deliveries are stored + required: true + default: "some-repo" + + artifactory_access_key: + type: string + description: Artifactory access key + required: true + default: "" + + mission: + type: choice + description: Mission name (e.g. hst) + options: + - hst + - jwst + - roman + - generic + required: true + default: "generic" + + build_name: + type: string + description: Build name (e.g. MYPIPELINE-1.2.3) + required: true + default: "" + + destination: + type: string + description: Path to store an indexed delivery on-disk + required: true + default: "/path/to/stasis/releases" + + stasis_indexer_args: + type: string + description: Additional arguments passed to stasis_indexer + required: false + default: "" + + # program options + option_continue_on_error: + type: boolean + required: false + default: false + + option_config: + type: string + required: false + default: false + + option_cpu_limit: + type: string + required: false + default: "" + + option_pool_status_interval: + type: string + required: false + default: "" + + option_python: + type: string + required: false + default: "" + + option_verbose: + type: string + required: false + default: "" + + option_unbuffered: + type: boolean + required: false + default: false + + option_update_base: + type: boolean + required: false + default: false + + option_fail_fast: + type: boolean + required: false + default: false + + option_overwrite: + type: boolean + required: false + default: false + + option_no_docker: + type: boolean + required: false + default: false + + option_no_artifactory: + type: boolean + required: false + default: false + + option_no_artifactory_upload: + type: boolean + required: false + default: false + + option_no_artifactory_build_info: + type: boolean + required: false + default: false + + option_no_testing: + type: boolean + required: false + default: false + + option_no_parallel: + type: boolean + required: false + default: false + + option_delivery_file: + type: string + required: true + default: "" + +env: + REMOTE_PATHS: "/path/to/somewhere" + +runs: + using: "composite" + steps: + - uses: actions/checkout@v4 + + - name: Install STASIS dependencies + run: | + sudo apt-get update + sudo apt-get install -y ca-certificates cmake libcurl4-openssl-dev libxml2-dev rsync + shell: bash + + - name: Set TMPDIR + run: | + echo TMPDIR=${{ runner.temp }} >> $GITHUB_ENV + shell: bash + + - name: Install SSHFS + run: | + sudo apt update + sudo apt -y install sshfs + shell: bash + + - name: Mount external data areas + run: | + for remote in $REMOTE_PATHS; do + echo mounting $remote + done + shell: bash + + - uses: actions/checkout@v4 + with: + repository: 'spacetelescope/stasis' + path: ${{ github.workspace }}/stasis + + - name: Build STASIS + run: | + rm -rf ${{ github.workspace }}/stasis/build + cd ${{ github.workspace }}/stasis + mkdir -p build + cd build + cmake .. \ + -DCMAKE_INSTALL_PREFIX="${{ inputs.prefix }}" \ + -DCMAKE_BUILD_TYPE="RelWithDebInfo" + make + make install + echo "PATH=${{ inputs.prefix }}/bin:$PATH" >> $GITHUB_ENV + shell: bash + + - name: Configure program arguments + run: | + echo "option_continue_on_error=${{ inputs.option_continue_on_error && '--continue-on-error' || '' }}" >> $GITHUB_ENV + echo "option_config=${{ inputs.option_config && '--config ${{ inputs.option_config }}' || '' }}" >> $GITHUB_ENV + echo "option_cpu_limit=${{ inputs.option_cpu_limit && '--cpu-limit ${{ inputs.option_cpu_limit }}' || '' }}" >> $GITHUB_ENV + echo "option_pool_status_interval=${{ inputs.option_pool_status_interval && '--pool-status-interval ${{ inputs.option_pool_status_interval }}' }}" >> $GITHUB_ENV + echo "option_python=${{ inputs.option_python && '--python ${{ inputs.option_python }}' || '' }}" >> $GITHUB_ENV + echo "option_verbose=${{ inputs.option_verbose && '--verbose' || '' }}" >> $GITHUB_ENV + echo "option_unbuffered=${{ inputs.option_unbuffered && '--unbuffered' || ''}}" >> $GITHUB_ENV + echo "option_update_base=${{ inputs.option_update_base && '--update-base' || '' }}" >> $GITHUB_ENV + echo "option_fail_fast=${{ inputs.option_fail_fast && '--fail-fast' || '' }}" >> $GITHUB_ENV + echo "option_overwrite=${{ inputs.option_overwrite && '--overwrite' || '' }}" >> $GITHUB_ENV + echo "option_no_docker=${{ inputs.option_no_docker && '--no-docker' || '' }}" >> $GITHUB_ENV + echo "option_no_artifactory=${{ inputs.option_no_artifactory && '--no-artifactory' || '' }}" >> $GITHUB_ENV + echo "option_no_artifactory_upload=${{ inputs.option_no_artifactory_upload && '--no-artifactory-upload' }}" >> $GITHUB_ENV + echo "option_no_artifactory_build_info=${{ inputs.option_no_artifactory_build_info && '--no-artifactory-build-info' || '' }}" >> $GITHUB_ENV + echo "option_no_testing=${{ inputs.option_no_testing && '--no-testing' || '' }}" >> $GITHUB_ENV + echo "option_no_parallel=${{ inputs.option_no_parallel && '--no-parallel' || '' }}" >> $GITHUB_ENV + #echo "option_delivery_file=${{ inputs.option_delivery_file }}" >> $GITHUB_ENV + + - name: Run STASIS + run: | + args="" + for arg in $(compgen -A variable | grep option_); do + if [[ -n "$arg" ]]; then + args+="${!arg} " + fi + done + + stasis \ + $args \ + ${{ inputs.stasis_args }} \ + ${{ inputs.option_delivery_file + shell: bash + env: + #Artifactory service URL (ending in /artifactory) + STASIS_JF_ARTIFACTORY_URL: ${{ inputs.artifactory_url }}/artifactory + #Artifactory "generic" repository to write to + STASIS_JF_REPO: ${{ inputs.artifactory_repo }} + STASIS_JF_ACCESS_TOKEN: ${{ inputs.artifactory_access_key }} diff --git a/.github/workflows/pipeline_run.yml b/.github/workflows/pipeline_run.yml new file mode 100644 index 0000000..f9ebe17 --- /dev/null +++ b/.github/workflows/pipeline_run.yml @@ -0,0 +1,37 @@ +name: Publish Pipeline + +run-name: | + Publish pipeline to Artifactory + +on: + workflow_dispatch: + inputs: + delivery_file: + type: string + description: Delivery file + required: true + default: "" + + stasis_args: + type: string + description: Arguments to pass to STASIS + required: false + default: "" + +jobs: + publish: + name: Publish + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: STASIS (${{ runner.os }}-${{ runner.arch }}) + uses: ./.github/actions/stasis + with: + prefix: ${{ github.workspace }}/.local + artifactory_url: https://blah.tld + artifactory_repo: ${{ inputs.artifactory_repo }} + stasis_args: ${{ inputs.stasis_args }} + option_delivery_file: ${{ inputs.delivery_file }} + |