Repository navigation
[dtq-dev-93] Restore dataquest CI/CD workflows removed for the UFAL handoff #1736
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| name: 'Erase dspace db' | ||
| description: 'CI/CD Erase db' | ||
|
|
||
| inputs: | ||
| INSTANCE: | ||
| description: 'port suffix' | ||
| required: true | ||
| type: string | ||
| NAME: | ||
| description: 'docker compose project name' | ||
| required: true | ||
| type: string | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
|
|
||
| - name: stop and remove containers | ||
| shell: bash | ||
| env: | ||
| INSTANCE: ${{ inputs.INSTANCE }} | ||
| run: | | ||
| docker stop dspacesolr$INSTANCE dspacedb$INSTANCE dspace$INSTANCE dspace-angular$INSTANCE || true | ||
| docker rm dspacesolr$INSTANCE dspacedb$INSTANCE dspace$INSTANCE dspace-angular$INSTANCE || true | ||
|
|
||
| - name: remove volumes | ||
| shell: bash | ||
| env: | ||
| NAME: ${{ inputs.NAME }} | ||
| run: | | ||
| echo "Removing volumes for $(docker volume ls --filter name="${NAME}_" -q)" | ||
| docker volume rm $(docker volume ls --filter name="${NAME}_" -q) || true | ||
|
|
||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| name: 'Import dspace db' | ||
| description: 'CI/CD import db' | ||
|
|
||
| inputs: | ||
| DATADIR: | ||
| description: 'data dir with dump, icons' | ||
| required: true | ||
| type: string | ||
| INSTANCE: | ||
| description: 'port suffix' | ||
| required: true | ||
| type: string | ||
| ASSETSTORE: | ||
| description: 'location of assetstore folder' | ||
| required: false | ||
| type: string | ||
| ADMIN_PASSWORD: | ||
| description: 'Admin password for DSpace' | ||
| required: true | ||
| type: string | ||
| LOGDIR: | ||
| description: 'Directory for log files' | ||
| required: false | ||
| type: string | ||
|
Kasinhou marked this conversation as resolved.
Resolved
|
||
| default: '' | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
|
|
||
| - name: info | ||
| shell: bash | ||
| run: | | ||
| docker ps -a | ||
|
|
||
| - uses: actions/checkout@v4 | ||
| with: | ||
| repository: dataquest-dev/dspace-import-clarin | ||
| ref: 'main' | ||
| submodules: 'recursive' | ||
| path: 'dspace-import-clarin' | ||
|
|
||
|
|
||
| - name: stop and remove containers | ||
| id: import | ||
| shell: bash | ||
| working-directory: dspace-import-clarin/scripts | ||
| env: | ||
| DATADIR: ${{ inputs.DATADIR }} | ||
| DB5PORT: 15432 | ||
| DB5NAME: dspace-import-db5 | ||
| DB7PORT: 543${{ inputs.INSTANCE }} | ||
| BEURL: http://dev-5.pc:8${{ inputs.INSTANCE }}/repository/server/api | ||
| BEUSERNAME: dspace.admin.dev@dataquest.sk | ||
| BEUSERPASSWORD: ${{ inputs.ADMIN_PASSWORD }} | ||
| run: | | ||
| docker stop $DB5NAME || true | ||
| echo "=====" | ||
| echo Starting import DB | ||
| # create otherwise it will be created with root owner | ||
| cid=$(docker run -d --rm --name $DB5NAME -v $(pwd):/dq/scripts -v $DATADIR/dump:/dq/dump -p 127.0.0.1:$DB5PORT:5432 -e POSTGRES_DB=empty -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=dspace postgres /bin/bash -c "cd /dq/scripts && ./init.dspacedb5.sh") | ||
| echo "cid=$cid" >> $GITHUB_OUTPUT | ||
| sleep 60 | ||
| # copy assetstore | ||
| echo Preparing assetstore | ||
| if [[ -z ${{ inputs.ASSETSTORE }} ]]; then | ||
| echo Location of assetstore folder is empty. Not copping assetstore | ||
| else | ||
| docker cp ${{ inputs.ASSETSTORE }} dspace${{ inputs.INSTANCE }}:/dspace/ | ||
| docker exec -u root dspace${{ inputs.INSTANCE }} chown -R dspace:dspace /dspace/assetstore | ||
| fi | ||
| echo "=====" | ||
| cd ../ | ||
| pip install -r requirements.txt || true | ||
|
Kasinhou marked this conversation as resolved.
Resolved
|
||
| echo "=====" | ||
| cd ./src | ||
| # cleanup resume | ||
| rm __temp/resume/*.json || true | ||
| # arguments of the script | ||
| # required | ||
| echo "=====" | ||
| # Generate the current timestamp for the log filename | ||
| timestamp=$(date +"%y%m%d%H%M") | ||
| log_file_timestamp="${{ inputs.LOGDIR }}python.${timestamp}.log" | ||
| echo $log_file_timestamp | ||
| mkdir ../__logs | ||
| # Continuously append to the log file $log_file_timestamp. Start appending when the first file is added to the __logs folder. | ||
| inotifywait -m -e create --format "%w%f" ../__logs/ | while IFS= read -r file; do tail -F --retry "$file" >> "$log_file_timestamp" 2>/dev/null & done & | ||
| echo "=====" | ||
| args=( | ||
| --resume=false | ||
| --config=backend.endpoint=$BEURL | ||
| --config=backend.user=$BEUSERNAME | ||
| --config=backend.password=$BEUSERPASSWORD | ||
| --config=db_dspace_7.port=$DB7PORT | ||
| --config=db_dspace_5.port=$DB5PORT | ||
| --config=db_utilities_5.port=$DB5PORT | ||
| --config=input.datadir=$DATADIR/data/ | ||
| --config=input.icondir=$DATADIR/icon/ | ||
| ) | ||
| # Add --resume argument if inputs.ASSETSTORE is defined | ||
| if [ -n "${{ inputs.ASSETSTORE }}" ]; then | ||
| args+=(--assetstore=${{ inputs.ASSETSTORE }}) | ||
| fi | ||
| python3 repo_import.py "${args[@]}" | ||
| - name: cleanup | ||
| shell: bash | ||
| run: | | ||
| docker stop ${{ steps.import.outputs.cid }} || true | ||
| if: ${{ always() }} | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.