Skip to content

Instantly share code, notes, and snippets.

@javaguirre
Last active February 21, 2019 11:22
Show Gist options
  • Save javaguirre/f3270955476e8f833131afee243e5316 to your computer and use it in GitHub Desktop.
Save javaguirre/f3270955476e8f833131afee243e5316 to your computer and use it in GitHub Desktop.
Deploy stage on IBM Blockchain for Hyperledger Fabric
deploy_staging:
  stage: deploy
  script:
# Install chaincode in IBM Blockchain
  - >
"curl -X POST https://$NETWORK_STAGING_KEY:$NETWORK_STAGING_PASS@blockchain-starter.eu-gb.bluemix.net/api/v1/networks/$NETWORK_STAGING_ID/chaincode/install
-H 'accept: application/json'
-H 'Content-Type: multipart/form-data'
-F 'files=@chaincode/chaincode_name/chaincode_name.go'
-F 'chaincode_id=chaincode_name'
-F \"chaincode_version=$CI_COMMIT_SHA\"
-F 'chaincode_type=golang'"
  # Instantiate chaincode in the Channel $CHANNEL_STAGING_ID
- >
"curl -X POST https://$NETWORK_STAGING_KEY:$NETWORK_STAGING_PASS@blockchain-starter.eu-gb.bluemix.net/api/v1/networks/$NETWORK_STAGING_ID/channels/$CHANNEL_STAGING_ID/chaincode/instantiate
-H 'accept: application/json'
-H 'Content-Type: application/json'
--data '{ \"chaincode_id\": \"chaincode_name\",
\"chaincode_version\": \"'\"$CI_COMMIT_SHA\"'\",
\"chaincode_type\": \"golang\",
\"chaincode_arguments\": [],
\"endorsement_policy\": { \"identities\": [
{ \"role\": { \"name\": \"member\", \"mspId\": \"org1\" } },
{ \"role\": { \"name\": \"member\", \"mspId\": \"org2\" } }
], \"policy\": { \"1-of\": [ { \"signed-by\": 0 }, { \"signed-by\": 1 } ] } }}'"
  only:
  - master
deploy_production:
  stage: deploy
  script:
# Install chaincode in IBM Blockchain
  - >
"curl -X POST https://$NETWORK_KEY:$NETWORK_PASS@blockchain-starter.eu-gb.bluemix.net/api/v1/networks/$NETWORK_ID/chaincode/install
-H 'accept: application/json'
-H 'Content-Type: multipart/form-data'
-F 'files=@chaincode/chaincode_name/chaincode_name.go'
-F 'chaincode_id=chaincode_name'
-F \"chaincode_version=$CI_COMMIT_TAG\"
-F 'chaincode_type=golang'"
  # Instantiate chaincode in the Channel $CHANNEL_PRODUCTION_ID
- >
"curl -X POST https://$NETWORK_KEY:$NETWORK_PASS@blockchain-starter.eu-gb.bluemix.net/api/v1/networks/$NETWORK_ID/channels/$CHANNEL_PRODUCTION_ID/chaincode/instantiate
-H 'accept: application/json'
-H 'Content-Type: application/json'
--data '{ \"chaincode_id\": \"chaincode_name\",
\"chaincode_version\": \"'\"$CI_COMMIT_TAG\"'\",
\"chaincode_type\": \"golang\",
\"chaincode_arguments\": [],
\"endorsement_policy\": { \"identities\": [
{ \"role\": { \"name\": \"member\", \"mspId\": \"org1\" } },
{ \"role\": { \"name\": \"member\", \"mspId\": \"org2\" } }
],
\"policy\": { \"1-of\": [ { \"signed-by\": 0 }, { \"signed-by\": 1 } ] } }}'"
  only:
  - tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment