Workshop deploy Solr configset #1
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: Workshop deploy Solr configset | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: tag | |
required: true | |
configset_name: | |
description: name of the configset. Usually biblio_yyyymmdd | |
required: true | |
jobs: | |
deploy-configset: | |
name: Zip and send configset | |
runs-on: ubuntu-latest | |
environment: workshop | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check that the tag exists in repo | |
id: tag_check | |
run: | | |
if [ -z $TAG ]; then | |
echo "tag=`git rev-parse HEAD`" >> $GITHUB_OUTPUT | |
elif git rev-parse "refs/tags/$TAG" &> /dev/null; then | |
echo "tag=$TAG" >> $GITHUB_OUTPUT | |
elif git rev-parse "$TAG" &> /dev/null; then | |
SHA=`git rev-parse "$TAG"` | |
echo "$TAG corresponds to $SHA" | |
echo "tag=$SHA" >> $GITHUB_OUTPUT | |
else | |
echo "Couldn't figure out tag from input: $TAG" | |
echo "Aborting deployment." | |
false | |
fi | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ steps.tag_check.outputs.tag }} | |
- name: zip configset | |
env: | |
TAG: ${{ steps.tag_check.outputs.tag }} | |
run: | | |
cd biblio/conf | |
echo -n $TAG > version.txt | |
zip -r ../biblio.zip . | |
- name: send configset to workshop | |
env: | |
USER: ${{ vars.SOLR_USER }} | |
PASSWORD: ${{ secrets.SOLR_PASSWORD }} | |
HOST: ${{ vars.SOLR_HOST }} | |
BIBLIO: ${{ github.event.inputs.configset_name }} | |
run: | | |
cd biblio | |
echo "Sending configset" | |
# -f causes non 0 return if not response 200 | |
curl -f -u $USER:$PASSWORD -X PUT --header "Content-Type: applicatgion/octet-stream" --data-binary @biblio.zip "$HOST/api/cluster/configs/$BIBLIO" || exit |