From 79dbc3538b3589c7b97707118601871504a823b3 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Fri, 30 Aug 2024 14:50:11 -0500 Subject: [PATCH] And CI job using request-webapp-deployment --- .gitea/workflows/encrypted.yaml | 42 +++++++++++++++++++++ .gitea/workflows/triggers/encrypted | 0 scripts/request-app-deployment-encrypted.sh | 40 ++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 .gitea/workflows/encrypted.yaml create mode 100644 .gitea/workflows/triggers/encrypted create mode 100755 scripts/request-app-deployment-encrypted.sh diff --git a/.gitea/workflows/encrypted.yaml b/.gitea/workflows/encrypted.yaml new file mode 100644 index 0000000..395772c --- /dev/null +++ b/.gitea/workflows/encrypted.yaml @@ -0,0 +1,42 @@ +name: Test Encrypted Config +on: + push: + branches: '*' + paths: + - '!**' + - '.gitea/workflows/triggers/encrypted' + +env: + CERC_REGISTRY_USER_KEY: ${{ secrets.CICD_VAASL_LACONIC_USER_KEY }} + CERC_REGISTRY_BOND_ID: ${{ secrets.CICD_VAASL_LACONIC_BOND_ID }} + CERC_REGISTRY_DEPLOYER_LRN: ${{ vars.CERC_REGISTRY_DEPLOYER_LRN }} + CERC_REGISTRY_DEPLOYMENT_HOSTNAME: ${{ vars.CERC_REGISTRY_DEPLOYMENT_HOSTNAME }}-crypt + CERC_REGISTRY_DEPLOYMENT_REQUEST_USER_KEY: ${{ secrets.CICD_VAASL_DEPLOYMENT_REQUEST_USER_KEY }} + CERC_REGISTRY_DEPLOYMENT_REQUEST_BOND_ID: ${{ secrets.CICD_VAASL_DEPLOYMENT_REQUEST_BOND_ID }} + CERC_REGISTRY_DEPLOYMENT_REQUEST_PAYMENT_TO: ${{ secrets.CICD_VAASL_DEPLOYMENT_REQUEST_PAYMENT_TO }} + +jobs: + cns_publish: + runs-on: ubuntu-latest + steps: + - name: "Clone project repository" + uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: "Enable Yarn" + run: corepack enable + - name: "Install registry CLI" + run: | + npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ + npm install -g @cerc-io/laconic-registry-cli + - name: "Install jq and gpg" + run: apt -y update && apt -y install jq gpg + - name: "Install laconic-so" + run: | + curl -LO https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so + chmod +x ./laconic-so + mv ./laconic-so /usr/bin/laconic-so + - name: "Request Deployment w/ Encrypted Config" + run: scripts/request-app-deployment-encrypted.sh diff --git a/.gitea/workflows/triggers/encrypted b/.gitea/workflows/triggers/encrypted new file mode 100644 index 0000000..e69de29 diff --git a/scripts/request-app-deployment-encrypted.sh b/scripts/request-app-deployment-encrypted.sh new file mode 100755 index 0000000..3516b66 --- /dev/null +++ b/scripts/request-app-deployment-encrypted.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +set -e + +CONFIG_FILE=`mktemp` +ENV_FILE=`mktemp` + +rcd_name=$(jq -r '.name' package.json | sed 's/null//' | sed 's/^@//') +rcd_app_version=$(jq -r '.version' package.json | sed 's/null//') + +cat < "$CONFIG_FILE" +services: + registry: + rpcEndpoint: '${CERC_REGISTRY_RPC_ENDPOINT:-http://testnet-a-1.dev.vaasl.io:26657}' + gqlEndpoint: '${CERC_REGISTRY_GQL_ENDPOINT:-http://testnet-a-1.dev.vaasl.io:9473/api}' + chainId: ${CERC_REGISTRY_CHAIN_ID:-laconic-08062024} + gas: 900000 + fees: 900000alnt +EOF + +if [ -z "$CERC_REGISTRY_APP_LRN" ]; then + authority=$(echo "$rcd_name" | cut -d'/' -f1 | sed 's/@//') + app=$(echo "$rcd_name" | cut -d'/' -f2-) + CERC_REGISTRY_APP_LRN="lrn://$authority/applications/$app" +fi + +cat >$ENV_FILE <