From e98d28a43d7306d91737fde0beacd6780a6cf51a Mon Sep 17 00:00:00 2001 From: "Yuri (solarw) Turchenkov" Date: Mon, 22 Jan 2024 14:10:31 +0300 Subject: [PATCH 1/3] CI propel deployment --- .github/workflows/release.yaml | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2fb108775..d3ae7b9c3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -94,3 +94,56 @@ jobs: docker push $DOCKER_USER/oar-$AGENT:$VERSION docker push $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG + deploy-service-on-propel: + name: Deploy service on propel + needs: + - "publish-packages" + - "publish-images" + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["3.10"] + env: + CMD: "propel -U ${{ vars.PROPEL_BASE_URL }}" + steps: + - uses: actions/checkout@master + - uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-versions }} + - name: Install dependencies + run: | + sudo apt-get update --fix-missing + sudo apt-get autoremove + sudo apt-get autoclean + python -m pip install --upgrade pip + pip install propel-client==0.0.10 open-autonomy + + - name: Make use proxy instead of actual nlb by dns override + run: | + # for staging + export IP_ADDR=$(dig +short balancer.tcp.propel.staging.autonolas.tech) + echo -e "\n$IP_ADDR\tapp.propel.staging.valory.xyz\n" | sudo tee -a /etc/hosts + + # for prod + export IP_ADDR=$(dig +short balancer.tcp.propel.autonolas.tech) + echo -e "\n$IP_ADDR\tapp.propel.valory.xyz\n" | sudo tee -a /etc/hosts + + - name: Login to propel + run: | + $CMD login -u ${{ secrets.PROPEL_USERNAME }} -p ${{ secrets.PROPEL_PASSWORD }} + + - name: Do a deployment + run: | + # determine ipfs hash id + export IPFS_HASH=$(jq '.dev | to_entries[] | select(.key | startswith("service"))| .value' -r ./packages/packages.json | head -n1) + export SERVICE_PATH=service_for_propel + + # fetch service file and check it published + autonomy init --reset --author ci --ipfs --remote + autonomy fetch $IPFS_HASH --service --alias $SERVICE_PATH + + # get env vars from github actions + echo '${{ toJSON(secrets) }}' | jq -r 'to_entries|map("export \(.key)=\(.value|tojson)")|.[]' > github.vars + source github.vars + $CMD service deploy --name ${{ vars.SERVICE_NAME }} --service-dir $SERVICE_PATH --service-ipfs-hash $IPFS_HASH --ingress-enabled true --keys ${{ vars.SERVICE_KEYS }} --timeout 320 From 78e33a360031d1539e262318212f8e5fd28bd289 Mon Sep 17 00:00:00 2001 From: "Yuri (solarw) Turchenkov" Date: Tue, 23 Jan 2024 12:49:07 +0300 Subject: [PATCH 2/3] use env vars and secrets same time. use deployment environments --- .github/workflows/release.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d3ae7b9c3..9ffe83da3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,7 +2,7 @@ name: Release Flow on: release: - types: [published] + types: [prereleased, released] jobs: publish-packages: @@ -96,6 +96,7 @@ jobs: deploy-service-on-propel: name: Deploy service on propel + environment: ${{ github.event.action == 'released' && 'production' || 'staging' }} needs: - "publish-packages" - "publish-images" @@ -145,5 +146,7 @@ jobs: # get env vars from github actions echo '${{ toJSON(secrets) }}' | jq -r 'to_entries|map("export \(.key)=\(.value|tojson)")|.[]' > github.vars + echo >> github.vars + echo '${{ toJSON(vars) }}' | jq -r 'to_entries|map("export \(.key)=\(.value|tojson)")|.[]' >> github.vars source github.vars $CMD service deploy --name ${{ vars.SERVICE_NAME }} --service-dir $SERVICE_PATH --service-ipfs-hash $IPFS_HASH --ingress-enabled true --keys ${{ vars.SERVICE_KEYS }} --timeout 320 From 04519ba096311de3d6bf26c8d73c772c4af86b8f Mon Sep 17 00:00:00 2001 From: "Yuri (solarw) Turchenkov" Date: Tue, 23 Jan 2024 13:43:58 +0300 Subject: [PATCH 3/3] minor fix --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9ffe83da3..df751fc4a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -132,7 +132,7 @@ jobs: - name: Login to propel run: | - $CMD login -u ${{ secrets.PROPEL_USERNAME }} -p ${{ secrets.PROPEL_PASSWORD }} + $CMD login -u ${{ vars.PROPEL_USERNAME }} -p ${{ secrets.PROPEL_PASSWORD }} - name: Do a deployment run: |