Browse Source

Merge pull request #3189 from ahhda/olympia-pg-fixes-3187

DevOps - Olympia Deploy playground parameter updates
Mokhtar Naamani 3 years ago
parent
commit
670300f089

+ 8 - 3
.github/workflows/deploy-playground.yml

@@ -27,6 +27,9 @@ on:
         description: 'Optionally skip running newChainSetup script (true or false)'
         required: true
         default: 'false'
+      proposalParameters:
+        description: 'Proposal Parameters (refer to runtime/src/proposals_configuration/sample_proposal_parameters.json for sample)'
+        required: false
       # TODO: customDomain instead of ip_address.nip.io
       # customDomain:
       #   description: 'DNS hostname to use for deployment'
@@ -88,7 +91,9 @@ jobs:
           options: |
             --extra-vars "git_repo=${{ github.event.inputs.gitRepo }} \
                           branch_name=${{ github.event.inputs.branchName }} \
-                          skip_chain_setup=${{ github.event.inputs.skipChainSetup }}"
+                          skip_chain_setup=${{ github.event.inputs.skipChainSetup }} \
+                          proposal_parameters='${{ github.event.inputs.proposalParameters }}' \
+                          stack_name=${{ env.STACK_NAME }}"
 
       - name: Save the endpoints file as an artifact
         uses: actions/upload-artifact@v2
@@ -97,8 +102,8 @@ jobs:
           path: devops/aws/endpoints.json
 
       - name: Delete CloudFormation Stack if any step failed
-        # Skip if stack already existed
-        if: failure() && steps.stack_exists.outcome != 'failure'
+        # Skip only if stack already existed or all steps passed successfully
+        if: ( failure() || cancelled() ) && steps.stack_exists.outcome != 'failure'
         run: |
           echo "Deleting ${{ env.STACK_NAME }} stack"
           aws cloudformation delete-stack --stack-name ${{ env.STACK_NAME }}

+ 3 - 0
.gitignore

@@ -40,6 +40,9 @@ yarn*
 test-data/
 tmp.*
 
+# env variables saved as artifacts for builds
+runtime-inputs/
+
 .my_setup
 
 devops/infrastructure

+ 4 - 0
devops/aws/deploy-playground-playbook.yml

@@ -55,6 +55,8 @@
       command: yarn build:node:docker
       args:
         chdir: '{{ remote_code_path }}'
+      environment:
+        ALL_PROPOSALS_PARAMETERS_JSON: '{{ proposal_parameters }}'
       async: 3600
       poll: 0
       register: node_build_result
@@ -119,6 +121,8 @@
           indexer: https://{{ nip_domain }}/query-node/indexer/graphql
           member_faucet: https://{{ nip_domain }}/member-faucet/register
           orion: https://{{ nip_domain }}/orion/graphql
+          config: https://{{ nip_domain }}/network/config.json
+          stack_name: {{ stack_name }}
       run_once: yes
 
     - name: Print endpoints

+ 2 - 1
devops/aws/deploy-playground.sh

@@ -42,5 +42,6 @@ if [ $? -eq 0 ]; then
 
   echo -e "\n\n=========== Configuring node ==========="
   ansible-playbook -i $SERVER_IP, --private-key $KEY_PATH deploy-playground-playbook.yml \
-    --extra-vars "branch_name=$BRANCH_NAME git_repo=$GIT_REPO skip_chain_setup=$SKIP_CHAIN_SETUP"
+    --extra-vars "branch_name=$BRANCH_NAME git_repo=$GIT_REPO skip_chain_setup=$SKIP_CHAIN_SETUP
+                  stack_name=$SINGLE_NODE_STACK_NAME proposal_parameters=$ALL_PROPOSALS_PARAMETERS_JSON"
 fi

+ 2 - 1
devops/aws/deploy-single-node.sample.cfg

@@ -20,4 +20,5 @@ CHAIN_SPEC_FILE="https://github.com/Joystream/joystream/releases/download/v9.14.
 # For deploy playground playbook only
 GIT_REPO="https://github.com/Joystream/joystream.git"
 BRANCH_NAME="master"
-SKIP_CHAIN_SETUP="false"
+SKIP_CHAIN_SETUP="false"
+ALL_PROPOSALS_PARAMETERS_JSON=""

+ 1 - 1
devops/aws/templates/Playground-Caddyfile.j2

@@ -48,7 +48,7 @@ wss://{{ nip_domain }}/query-node/server* {
     reverse_proxy localhost:3002
 }
 
-{{ nip_domain }}/config.json {
+{{ nip_domain }}/network/config.json {
     header /* {
       Access-Control-Allow-Origin *
     }

+ 14 - 2
scripts/runtime-code-shasum.sh

@@ -15,7 +15,19 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
 fi
 
 export TEST_NODE_BLOCKTIME=1000
-export TEST_PROPOSALS_PARAMETERS_PATH="./tests/integration-tests/proposal-parameters.json"
+
+if [[ -n "$ALL_PROPOSALS_PARAMETERS_JSON" ]] && [[ -n "$TEST_NODE" ]]; then
+  echo "Do not set both TEST_NODE and ALL_PROPOSALS_PARAMETERS_JSON env variables"
+  exit 1
+elif [[ -z "$ALL_PROPOSALS_PARAMETERS_JSON" ]] && [[ -z "$TEST_NODE" ]]; then
+  PROPOSALS_PARAMETERS_FILE=""
+elif [[ -n "$TEST_NODE" ]]; then
+  PROPOSALS_PARAMETERS_FILE="./tests/integration-tests/proposal-parameters.json"
+else
+  mkdir -p runtime-inputs
+  PROPOSALS_PARAMETERS_FILE="./runtime-inputs/proposal-parameters-input.json"
+  echo $ALL_PROPOSALS_PARAMETERS_JSON > $PROPOSALS_PARAMETERS_FILE
+fi
 
 # sort/owner/group/mtime arguments only work with gnu version of tar!
 ${TAR} -c --sort=name --owner=root:0 --group=root:0 --mode 644 --mtime='UTC 2020-01-01' \
@@ -27,7 +39,7 @@ ${TAR} -c --sort=name --owner=root:0 --group=root:0 --mode 644 --mtime='UTC 2020
     joystream-node.Dockerfile \
     joystream-node-armv7.Dockerfile \
     node \
-    $(test -n "$TEST_NODE" && echo "$TEST_PROPOSALS_PARAMETERS_PATH") \
+    $PROPOSALS_PARAMETERS_FILE \
     | if [[ -n "$TEST_NODE" ]]; then ${SED} '$a'"$TEST_NODE_BLOCKTIME"; else tee; fi \
     | shasum \
     | cut -d " " -f 1