5 - Run CKAN Command #65
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: 5 - Run CKAN Command | |
on: | |
workflow_dispatch: | |
inputs: | |
environ: | |
description: 'Environment:' | |
required: true | |
type: choice | |
options: | |
- development | |
- staging | |
- prod | |
app: | |
description: 'App to run on:' | |
required: true | |
type: string | |
default: 'catalog-admin' | |
command: | |
description: 'Command to run:' | |
required: true | |
type: choice | |
options: | |
- 'ckan geodatagov check-stuck-jobs' | |
- 'ckan geodatagov db-solr-sync --dryrun' | |
- 'ckan geodatagov db-solr-sync --cleanup_solr' | |
- 'ckan geodatagov db-solr-sync --update_solr' | |
- 'ckan geodatagov db-solr-sync --cleanup_solr --update_solr' | |
- 'ckan harvester run' | |
- 'ckan geodatagov sitemap-to-s3' | |
- 'ckan geodatagov tracking-update' | |
- 'ckan report generate' | |
memory: | |
description: 'RAM to allocate:' | |
required: true | |
type: string | |
default: '2G' | |
disk: | |
description: 'Disk space to allocate:' | |
required: true | |
type: string | |
default: '1500M' | |
monitor: | |
description: 'Monitor log output?' | |
required: true | |
type: boolean | |
default: true | |
jobs: | |
ckan-command: | |
name: ${{inputs.command}} | |
runs-on: ubuntu-latest | |
environment: ${{inputs.environ}} | |
steps: | |
- name: Store Instance Name | |
run: | | |
INSTANCE_NAME="$(echo ckan-auto-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT})" | |
echo "INSTANCE_NAME=${INSTANCE_NAME}" | tee -a $GITHUB_ENV | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: run task | |
uses: cloud-gov/cg-cli-tools@main | |
with: | |
command: > | |
cf run-task ${{ inputs.app }} --command "${{ inputs.command }}" | |
--name $INSTANCE_NAME -k ${{ inputs.disk }} -m ${{ inputs.memory }} | |
cf_org: gsa-datagov | |
cf_space: ${{ inputs.environ }} | |
cf_username: ${{secrets.CF_SERVICE_USER}} | |
cf_password: ${{secrets.CF_SERVICE_AUTH}} | |
- name: monitor task output | |
if: ${{ inputs.monitor }} | |
uses: cloud-gov/cg-cli-tools@main | |
with: | |
command: > | |
tools/monitor_cf_logs.sh ${{ inputs.app }} $INSTANCE_NAME | |
cf_org: gsa-datagov | |
cf_space: ${{ inputs.environ }} | |
cf_username: ${{secrets.CF_SERVICE_USER}} | |
cf_password: ${{secrets.CF_SERVICE_AUTH}} |