IBM-Blockchain-Starter-Kit / build-lib

Common scripts for use in Blockchain build pipelines
https://ibm-blockchain-starter-kit.github.io/
Apache License 2.0
4 stars 14 forks source link

Work out how to manage updates to scripts #5

Closed jt-nti closed 6 years ago

jt-nti commented 6 years ago

A possible approach is to copy over scripts from a library repository (could be the same repository that holds the toolchain template, or a separate repository). I've prototyped this with a "prepare" job in https://github.com/hyperledger-composer-samples/hyperledger-composer-toolchain

Still needs a bit of thought around versioning/breaking changes. Possibly simply including a major version number in the script names, or keeping scripts in a versioned subdirectory, would be sufficient.

I would also like to consider how git tags/github releases could be used

jt-nti commented 6 years ago

Agreed with @jorgedr94 that git tags/github releases are the preferred option for managing versions. I'll investigate what the necessary commands to fetch common scripts released this way would be

jt-nti commented 6 years ago

Something like this embedded directly in the pipeline should be enough to bootstrap the process of using a specific version of scripts:

#!/bin/bash

(curl -sSL https://github.com/IBM-Blockchain-Starter-Kit/build-lib/releases/download/${BUILD_LIB_VERSION}/blockchain-build-lib.tgz
) > /tmp/blockchain-build-lib.tgz

mkdir -p /tmp/blockchain-build-lib
tar -xvf /tmp/blockchain-build-lib.tgz -C /tmp/blockchain-build-lib

source /tmp/blockchain-build-lib/scripts/pipeline-PREPARE.sh

A more complex script could use the github api to process releases and pick the latest compatible version but that is probably not necessary to start with.