aboutsummaryrefslogtreecommitdiff
path: root/.github/actions/stasis_indexer/action.yml
blob: 2f09710ac4ad6fbc49596d443395cd090f524d17 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: STASIS Indexer

description: |
  Executes the STASIS indexer with arguments

inputs:
  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: ""

env:
  REMOTE_PATHS: "/path/to/somewhere"

runs:
  using: "composite"
  steps:
    - uses: actions/checkout@v4

    - uses: actions/checkout@v4
      with:
        repository: 'spacetelescope/stasis'
        path: ${{ github.workspace }}/stasis

    - 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

    - name: Build STASIS
      run: |
        rm -rf ${{ github.workspace }}/stasis/build
        cd ${{ github.workspace }}/stasis
        mkdir -p build
        cd build
        cmake .. \
            -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/.local" \
            -DCMAKE_BUILD_TYPE="RelWithDebInfo"
        make
        make install
        echo "PATH=${{ github.workspace }}/.local/bin:$PATH" >> $GITHUB_ENV
      shell: bash

    - name: Run STASIS Indexer
      run: |
        src="${{ inputs.artifactory_repo }}/${{ inputs.mission }}/${{ inputs.build_name }}"
        dest="${{ inputs.destination }}/${{ inputs.mission }}/${{ inputs.build_name }}"
        stasis_indexer \
            --unbuffered \
            --verbose \
            --web \
            --dest "${dest}" \
            ${{ inputs.stasis_args }} \
            "$src"
      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 }}