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

bedrock hld init should produce a templated pipeline #56

Description

Related to microsoft/bedrock#1423

Currently we produce a AzDO pipeline yaml that looks like this:

# GENERATED WITH BEDROCK VERSION 0.6.5
trigger:
  branches:
    include:
      - master
variables:
  - group: quick-start-vg
pool:
  vmImage: ubuntu-latest
steps:
  - checkout: self
    persistCredentials: true
    clean: true
  - task: HelmInstaller@1
    inputs:
      helmVersionToInstall: 2.16.3
  - script: |-
      set -e
      # Download build.sh
      curl $BEDROCK_BUILD_SCRIPT > build.sh
      chmod +x ./build.sh
    displayName: Download bedrock bash scripts
    env:
      BEDROCK_BUILD_SCRIPT: $(BUILD_SCRIPT_URL)
  - script: |-
      set -e
      commitId=$(Build.SourceVersion)
      commitId=$(echo "${commitId:0:7}")
      . ./build.sh --source-only
      get_bedrock_version
      download_bedrock
      pullrequestid=$(az repos pr list --organization $(System.TeamFoundationCollectionUri) --project $(System.TeamProject) --status completed | jq -r --arg commitid "$(Build.SourceVersion)" '.[] | select(.lastMergeCommit.commitId | startswith($commitid))' | jq '.pullRequestId')
      if [[ -z "$pullrequestid" ]]; then
      ./bedrock/bedrock deployment create -n $(INTROSPECTION_ACCOUNT_NAME) -k $(INTROSPECTION_ACCOUNT_KEY) -t $(INTROSPECTION_TABLE_NAME) -p $(INTROSPECTION_PARTITION_KEY) --p3 $(Build.BuildId) --hld-commit-id $commitId
      else
      ./bedrock/bedrock deployment create -n $(INTROSPECTION_ACCOUNT_NAME) -k $(INTROSPECTION_ACCOUNT_KEY) -t $(INTROSPECTION_TABLE_NAME) -p $(INTROSPECTION_PARTITION_KEY) --p3 $(Build.BuildId) --hld-commit-id $commitId --pr $pullrequestid
      fi
    displayName: 'If configured, update manifest pipeline details in Spektate db before manifest generation'
    condition: 'and(ne(variables[''INTROSPECTION_ACCOUNT_NAME''], ''''), ne(variables[''INTROSPECTION_ACCOUNT_KEY''], ''''),ne(variables[''INTROSPECTION_TABLE_NAME''], ''''),ne(variables[''INTROSPECTION_PARTITION_KEY''], ''''), ne(variables[''Build.Reason''], ''PullRequest''))'
    env:
      AZURE_DEVOPS_EXT_PAT: $(PAT)
  - task: ShellScript@2
    displayName: Validate fabrikate definitions
    inputs:
      scriptPath: build.sh
    condition: 'eq(variables[''Build.Reason''], ''PullRequest'')'
    env:
      VERIFY_ONLY: 1
  - task: ShellScript@2
    displayName: Transform fabrikate definitions and publish to YAML manifests to repo
    inputs:
      scriptPath: build.sh
    condition: 'ne(variables[''Build.Reason''], ''PullRequest'')'
    env:
      ACCESS_TOKEN_SECRET: $(PAT)
      COMMIT_MESSAGE: $(Build.SourceVersionMessage)
      REPO: $(MANIFEST_REPO)
      BRANCH_NAME: $(Build.SourceBranchName)
  - script: |-
      set -e
      . ./build.sh --source-only
      cd "$HOME"/${MANIFEST_REPO##*/}
      latest_commit=$(git rev-parse --short HEAD)
      url=$(git remote --verbose | grep origin | grep fetch | cut -f2 | cut -d' ' -f1)
      repourl=${url##*@}
      get_bedrock_version
      download_bedrock
      ./bedrock/bedrock deployment create -n $(INTROSPECTION_ACCOUNT_NAME) -k $(INTROSPECTION_ACCOUNT_KEY) -t $(INTROSPECTION_TABLE_NAME) -p $(INTROSPECTION_PARTITION_KEY) --p3 $(Build.BuildId) --manifest-commit-id $latest_commit --repository $repourl
    displayName: 'If configured, update manifest pipeline details in Spektate db after manifest generation'
    condition: 'and(ne(variables[''INTROSPECTION_ACCOUNT_NAME''], ''''), ne(variables[''INTROSPECTION_ACCOUNT_KEY''], ''''),ne(variables[''INTROSPECTION_TABLE_NAME''], ''''),ne(variables[''INTROSPECTION_PARTITION_KEY''], ''''), ne(variables[''Build.Reason''], ''PullRequest''))'

Based upon information in microsoft/bedrock#1423 We should create a version of this Yaml that is templated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions