microsoft / bedrock-cli

The CLI for Bedrock
https://microsoft.github.io/bedrock-cli/commands/
MIT License
28 stars 12 forks source link

script to add hld update stage to existing pipelines yaml #48

Open bnookala opened 4 years ago

bnookala commented 4 years ago

As a:

bedrock user, but not necessarily a bedrock cli user

I want:

To be able to invoke a script to add an "hld-update" stage to existing pipelines yaml files.

So that:

I can bring my own custom build pipeline that produces a docker image pushed to a registry that I can use to update my HLD

Describe the solution you'd like:

Acceptance Criteria:

The steps following are the hld update stage verbatim from fileutilts.ts in bedrock-cli:

                  `export SERVICE_NAME_LOWER=$(echo ${serviceName} | tr '[:upper:]' '[:lower:]')`,
                  `export BUILD_REPO_NAME=${BUILD_REPO_NAME(serviceName)}`,
                  `export BRANCH_NAME=DEPLOY/$BUILD_REPO_NAME-${IMAGE_TAG}`,
                  `export FAB_SAFE_SERVICE_NAME=$(echo $SERVICE_NAME_LOWER | tr . - | tr / -)`,
                  `# --- From https://raw.githubusercontent.com/Microsoft/bedrock/master/gitops/azure-devops/release.sh`,
                  `. build.sh --source-only`,
                  ``,
                  `# Initialization`,
                  `verify_access_token`,
                  `init`,
                  `helm_init`,
                  ``,
                  `# Fabrikate`,
                  `get_fab_version`,
                  `download_fab`,
                  ``,
                  `# Clone HLD repo`,
                  `git_connect`,
                  `# --- End Script`,
                  ``,
                  `# Update HLD`,
                  `git checkout -b "$BRANCH_NAME"`,
                  `export BUILD_REPO_NAME=${BUILD_REPO_NAME(serviceName)}`,
                  `export IMAGE_TAG=${IMAGE_TAG}`,
                  `export IMAGE_NAME=$BUILD_REPO_NAME:$IMAGE_TAG`,
                  `echo "Image Name: $IMAGE_NAME"`,
                  `export IMAGE_REPO=${IMAGE_REPO}`,
                  `echo "Image Repository: $IMAGE_REPO"`,
                  `cd $(Build.Repository.Name)/$FAB_SAFE_SERVICE_NAME/${SAFE_SOURCE_BRANCH}`,
                  `echo "FAB SET"`,
                  `fab set --subcomponent chart image.tag=$IMAGE_TAG image.repository=$IMAGE_REPO/$BUILD_REPO_NAME`,
                  ``,

Assuming any such build stage downloads the build.sh script that provides a number of the functions invoked above, the remaining assumption left is that any pipeline that has the build pipeline stage injected offers a number of pipeline variables for the stage to be able to invoked properly. This should be made explicit to the end user, as pipelines will differ from project to project.

Describe alternatives you've considered:

Additional context:

Does this require updates to documentation?:

no