Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

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

Open
1 task
bnookala opened this issue Apr 20, 2020 · 0 comments · May be fixed by #41
Open
1 task

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

bnookala opened this issue Apr 20, 2020 · 0 comments · May be fixed by #41
Assignees

Comments

@bnookala
Copy link
Member

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:

  • A tool or script that accepts a path to an azure yaml file as a parameter that simply injects a stage to the pipelines yaml that updates a bedrock HLD repository with an image tag for a newly build service.

Acceptance Criteria:

  • Any such tool or script must be able to take an azure pipelines yaml file and inject a default build stage into it that will update an HLD repository. This "default" build stage does not need to be valid - and any number of warnings to let the user know of this should suffice.

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:

  • We've considered building custom build steps directly into spk, but decided against that solution as it can become complicated, and does not

Additional context:

  • Out of band request for tooling

Does this require updates to documentation?:

no

@andrebriggs andrebriggs transferred this issue from microsoft/bedrock May 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant