Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export const BEDROCK_FILENAME = "bedrock.yaml";
export const BUILD_SCRIPT_URL =
"https://raw.githubusercontent.com/Microsoft/bedrock/master/gitops/azure-devops/build.sh";

export const HELM_VERSION = "2.16.3";

export const HLD_COMPONENT_FILENAME = "component.yaml";

export const PROJECT_INIT_DEPENDENCY_ERROR_MESSAGE =
Expand Down
32 changes: 16 additions & 16 deletions src/lib/fileutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import yaml from "js-yaml";
import path from "path";
import {
ACCESS_FILENAME,
HELM_VERSION,
HLD_COMPONENT_FILENAME,
PROJECT_PIPELINE_FILENAME,
RENDER_HLD_PIPELINE_FILENAME,
Expand Down Expand Up @@ -162,7 +163,7 @@ export const serviceBuildAndUpdatePipeline = (
{
task: "HelmInstaller@1",
inputs: {
helmVersionToInstall: "2.16.3"
helmVersionToInstall: HELM_VERSION
}
},
{
Expand Down Expand Up @@ -234,7 +235,7 @@ export const serviceBuildAndUpdatePipeline = (
{
task: "HelmInstaller@1",
inputs: {
helmVersionToInstall: "2.16.3"
helmVersionToInstall: HELM_VERSION
}
},
{
Expand Down Expand Up @@ -281,18 +282,14 @@ export const serviceBuildAndUpdatePipeline = (
`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`,
`echo "GIT STATUS"`,
`git status`,
`echo "GIT ADD (git add -A)"`,
`git add -A`,
``,
`# Set git identity`,
`git config user.email "admin@azuredevops.com"`,
`git config user.name "Automated Account"`,
``,
`# Commit changes`,
`echo "GIT COMMIT"`,
`git commit -m "Updating $SERVICE_NAME_LOWER image tag to ${IMAGE_TAG}."`,
`echo "GIT ADD and COMMIT -- Will throw error if there is nothing to commit."`,
`git_commit_if_changes "Updating $SERVICE_NAME_LOWER image tag to ${IMAGE_TAG}." 1 unusedVar`,
``,
`# Git Push`,
`git_push`,
Expand Down Expand Up @@ -496,7 +493,7 @@ const manifestGenerationPipelineYaml = (): string => {
{
task: "HelmInstaller@1",
inputs: {
helmVersionToInstall: "2.16.3"
helmVersionToInstall: HELM_VERSION
}
},
{
Expand Down Expand Up @@ -696,7 +693,7 @@ const hldLifecyclePipelineYaml = (): string => {
{
task: "HelmInstaller@1",
inputs: {
helmVersionToInstall: "2.16.3"
helmVersionToInstall: HELM_VERSION
}
},
{
Expand Down Expand Up @@ -735,18 +732,21 @@ const hldLifecyclePipelineYaml = (): string => {
`git checkout -b "RECONCILE/$(Build.Repository.Name)-$(Build.BuildNumber)"`,
`echo "spk hld reconcile $(Build.Repository.Name) $PWD ./.."`,
`spk hld reconcile $(Build.Repository.Name) $PWD ./..`,
`echo "GIT STATUS"`,
`git status`,
`echo "GIT ADD (git add -A)"`,
`git add -A`,
``,
`# Set git identity`,
`git config user.email "admin@azuredevops.com"`,
`git config user.name "Automated Account"`,
``,
`# Commit changes`,
`echo "GIT COMMIT"`,
`git commit -m "Reconciling HLD with $(Build.Repository.Name)-$(Build.BuildNumber)."`,
`echo "GIT ADD and COMMIT -- Will NOT throw error if there is nothing to commit."`,
`didCommit=0`,
`git_commit_if_changes "Reconciling HLD with $(Build.Repository.Name)-$(Build.BuildNumber)." 0 didCommit`,
``,
`# Skip push and opening PR steps if there were no changes changes to commit.`,
`if [ $didCommit == 0 ]; then`,
`echo "DID NOT FIND CHANGES TO COMMIT. EXITING."`,
`exit 0`,
`fi`,
``,
`# Git Push`,
`git_push`,
Expand Down
33 changes: 16 additions & 17 deletions src/test/mockFactory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import yaml from "js-yaml";
import { VM_IMAGE } from "../lib/constants";
import { HELM_VERSION, VM_IMAGE } from "../lib/constants";
import {
BUILD_REPO_NAME,
generateYamlScript,
Expand Down Expand Up @@ -49,7 +49,7 @@ export const createTestServiceBuildAndUpdatePipelineYaml = (
{
task: "HelmInstaller@1",
inputs: {
helmVersionToInstall: "2.16.3"
helmVersionToInstall: HELM_VERSION
}
},
{
Expand Down Expand Up @@ -121,7 +121,7 @@ export const createTestServiceBuildAndUpdatePipelineYaml = (
{
task: "HelmInstaller@1",
inputs: {
helmVersionToInstall: "2.16.3"
helmVersionToInstall: HELM_VERSION
}
},
{
Expand Down Expand Up @@ -168,18 +168,14 @@ export const createTestServiceBuildAndUpdatePipelineYaml = (
`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`,
`echo "GIT STATUS"`,
`git status`,
`echo "GIT ADD (git add -A)"`,
`git add -A`,
``,
`# Set git identity`,
`git config user.email "admin@azuredevops.com"`,
`git config user.name "Automated Account"`,
``,
`# Commit changes`,
`echo "GIT COMMIT"`,
`git commit -m "Updating $SERVICE_NAME_LOWER image tag to ${IMAGE_TAG}."`,
`echo "GIT ADD and COMMIT -- Will throw error if there is nothing to commit."`,
`git_commit_if_changes "Updating $SERVICE_NAME_LOWER image tag to ${IMAGE_TAG}." 1 unusedVar`,
``,
`# Git Push`,
`git_push`,
Expand Down Expand Up @@ -325,7 +321,7 @@ export const createTestHldLifecyclePipelineYaml = (
{
task: "HelmInstaller@1",
inputs: {
helmVersionToInstall: "2.16.3"
helmVersionToInstall: HELM_VERSION
}
},
{
Expand Down Expand Up @@ -364,18 +360,21 @@ export const createTestHldLifecyclePipelineYaml = (
`git checkout -b "RECONCILE/$(Build.Repository.Name)-$(Build.BuildNumber)"`,
`echo "spk hld reconcile $(Build.Repository.Name) $PWD ./.."`,
`spk hld reconcile $(Build.Repository.Name) $PWD ./..`,
`echo "GIT STATUS"`,
`git status`,
`echo "GIT ADD (git add -A)"`,
`git add -A`,
``,
`# Set git identity`,
`git config user.email "admin@azuredevops.com"`,
`git config user.name "Automated Account"`,
``,
`# Commit changes`,
`echo "GIT COMMIT"`,
`git commit -m "Reconciling HLD with $(Build.Repository.Name)-$(Build.BuildNumber)."`,
`echo "GIT ADD and COMMIT -- Will NOT throw error if there is nothing to commit."`,
`didCommit=0`,
`git_commit_if_changes "Reconciling HLD with $(Build.Repository.Name)-$(Build.BuildNumber)." 0 didCommit`,
``,
`# Skip push and opening PR steps if there were no changes changes to commit.`,
`if [ $didCommit == 0 ]; then`,
`echo "DID NOT FIND CHANGES TO COMMIT. EXITING."`,
`exit 0`,
`fi`,
``,
`# Git Push`,
`git_push`,
Expand Down Expand Up @@ -426,7 +425,7 @@ export const createTestHldAzurePipelinesYaml = (
{
task: "HelmInstaller@1",
inputs: {
helmVersionToInstall: "2.16.3"
helmVersionToInstall: HELM_VERSION
}
},
{
Expand Down