Skip to content

Commit

Permalink
Set name
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwatson484 committed Nov 1, 2022
1 parent 349de30 commit f68c986
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.6
1.1.7
24 changes: 13 additions & 11 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ resources:
name: johnwatson484/helm-charts

parameters:
- name: name
type: string
- name: containerRepository
type: string
default:
Expand Down Expand Up @@ -34,8 +36,8 @@ parameters:
variables:
- group: SonarCloud
- group: Helm
- name: repo
value:
- name: repo
value: ${{ parameters.name }}
- name: testFileExists
value: false
- name: releaseExists
Expand Down Expand Up @@ -75,22 +77,22 @@ jobs:
inputs:
targetType: 'inline'
script: |
$repo = "$(Build.Repository.Name)"
$repo = $repo.Split("/") | Select-Object -Last 1
$repo = $(Build.Repository.Name)
$repo = $repo.Split('/')[-1]
Write-Host "##vso[task.setvariable variable=repo]$repo"
- task: PowerShell@2
displayName: Set variables
inputs:
targetType: 'inline'
script: |
script: |
if (!([string]::IsNullOrEmpty('${{ parameters.containerRepository }}')))
{
$containerRepository = '${{ parameters.containerRepository }}'
}
else
{
$containerRepository = 'johnwatson484/$(repo)'
$containerRepository = 'johnwatson484/${{ parameters.name }}'
}
Write-Host "##vso[task.setvariable variable=containerRepository;]$containerRepository"
if (!([string]::IsNullOrEmpty('${{ parameters.helmChartPath }}')))
Expand All @@ -99,7 +101,7 @@ jobs:
}
else
{
$helmChartPath = 'helm/$(repo)'
$helmChartPath = 'helm/${{ parameters.name }}'
}
Write-Host "##vso[task.setvariable variable=helmChartPath;]$helmChartPath"
Expand Down Expand Up @@ -189,7 +191,7 @@ jobs:
addPipelineData: false

- script: |
sed -i -e 's/image: .*/image: johnwatson484\/$(repo):$(version)/' $(Agent.BuildDirectory)/s/$(repo)/$(helmChartPath)/values.yaml
sed -i -e 's/image: .*/image: johnwatson484\/${{ parameters.name }}:$(version)/' $(Agent.BuildDirectory)/s/$(repo)/$(helmChartPath)/values.yaml
displayName: Update Helm values
- task: HelmInstaller@1
Expand Down Expand Up @@ -235,7 +237,7 @@ jobs:
git pull origin master
helm repo index . --merge ./index.yaml
git add .
git commit -m "$(repo) updated by Azure DevOps"
git commit -m "${{ parameters.name }} updated by Azure DevOps"
git push origin HEAD:master
displayName: Update Helm GitHub repository
Expand Down Expand Up @@ -300,7 +302,7 @@ jobs:
inputs:
sshEndpoint: 'Kubernetes Master'
sourceFolder: $(Agent.TempDirectory)
contents: $(repo)-values.yaml
contents: ${{ parameters.name }}-values.yaml
targetFolder: /tmp
condition: and(succeeded(), eq(${{ parameters.hasSecureHelmValuesFile }}, true), eq(${{ parameters.deploy }}, true))

Expand All @@ -311,7 +313,7 @@ jobs:
runOptions: inline
inline: |
helm repo update
helm upgrade --install --namespace ${{ parameters.namespace }} -f /tmp/$(repo)-values.yaml $(repo) --atomic lynxmagnus/$(repo) --version $(version) --create-namespace
helm upgrade --install --namespace ${{ parameters.namespace }} -f /tmp/$(repo)-values.yaml $(repo) --atomic lynxmagnus/$(repo) --version $(version) --create-namespace
condition: and(succeeded(), eq(${{ parameters.hasSecureHelmValuesFile }}, true), eq(${{ parameters.deploy }}, true))

- task: PublishBuildArtifacts@1
Expand Down

0 comments on commit f68c986

Please sign in to comment.