Skip to content

Commit

Permalink
[IT-3964] Update synapse client usage (#129)
Browse files Browse the repository at this point in the history
The latest version of the synapse client no longer supports
authentication with passwords, it now requires a personal access token
  • Loading branch information
zaro0508 authored Dec 14, 2024
1 parent 7bbe18f commit 99374fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ jobs:
# use older checkout version due to https://github.com/dawidd6/action-download-artifact/issues/261
- uses: actions/checkout@v2
- name: Import Synapse Data
run: ./import-data.sh $BRANCH $SYNAPSE_USERNAME $SYNAPSE_PASSWORD $DB_HOST $DB_USER $DB_PASS
run: ./import-data.sh $BRANCH $SYNAPSE_PASSWORD $DB_HOST $DB_USER $DB_PASS
env:
BRANCH: ${{ github.ref_name }}
SYNAPSE_USERNAME: ${{ secrets.SYNAPSE_USERNAME }}
SYNAPSE_PASSWORD: ${{ secrets.SYNAPSE_PASSWORD }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_USER: ${{ secrets.DB_USER }}
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ The following secrets need to be setup in Github for the scripts to deploy datab

Global secrets:

| Variable | Description | Example |
|----------------------|-----------------------------------|-----------------------------|
| SYNAPSE_USERNAME | The Synapse service user | syn-service-user |
| SYNAPSE_PASSWORD | The Synapse service user password | supersecret |
| Variable | Description | Example |
|----------------------|----------------------------------|----------------------------------|
| SYNAPSE_PASSWORD | Synapse service user token (PAT) | glY4283tLQHZ...0eXAiOi...JKV1QiL |


Context specific secrets for each environment that corresponds to a git branch (develop/staging/prod):
Expand Down
15 changes: 7 additions & 8 deletions import-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
set -e

BRANCH=$1
SYNAPSE_USERNAME=$2
SYNAPSE_PASSWORD=$3
DB_HOST=$4
DB_USER=$5
DB_PASS=$6
SYNAPSE_PASSWORD=$2
DB_HOST=$3
DB_USER=$4
DB_PASS=$5

CURRENT_DIR=$(pwd)
WORKING_DIR=$CURRENT_DIR
Expand All @@ -26,19 +25,19 @@ TEAM_IMAGES_ID=$(cat $WORKING_DIR/data-manifest.json | grep team-images-id | hea
echo "$BRANCH branch, DATA_VERSION = $DATA_VERSION, manifest id = $DATA_MANIFEST_ID"

# Download the manifest file from synapse
synapse -u $SYNAPSE_USERNAME -p $SYNAPSE_PASSWORD get --downloadLocation $DATA_DIR -v $DATA_VERSION $DATA_MANIFEST_ID
synapse -p $SYNAPSE_PASSWORD get --downloadLocation $DATA_DIR -v $DATA_VERSION $DATA_MANIFEST_ID

# Ensure there's a newline at the end of the manifest file; otherwise the last listed file will not be downloaded
# echo >> $DATA_DIR/data_manifest.csv

# Download all files referenced in the manifest from synapse
cat $DATA_DIR/data_manifest.csv | tail -n +2 | while IFS=, read -r id version; do
echo Downloading $id,$version
synapse -u $SYNAPSE_USERNAME -p $SYNAPSE_PASSWORD get --downloadLocation $DATA_DIR -v $version $id ;
synapse -p $SYNAPSE_PASSWORD get --downloadLocation $DATA_DIR -v $version $id ;
done

# Download team images
synapse -u $SYNAPSE_USERNAME -p $SYNAPSE_PASSWORD get -r --downloadLocation $TEAM_IMAGES_DIR/ $TEAM_IMAGES_ID
synapse -p $SYNAPSE_PASSWORD get -r --downloadLocation $TEAM_IMAGES_DIR/ $TEAM_IMAGES_ID

echo "Data Files: "
ls -al $WORKING_DIR
Expand Down

0 comments on commit 99374fc

Please sign in to comment.