Skip to content

Commit

Permalink
Add helm package step to drone builds (#29)
Browse files Browse the repository at this point in the history
* Add helm package step to drone builds

* Use dist directory for chart tgz

* Add printing the contents of dist to stage-binaries
  • Loading branch information
aiyengar2 authored Mar 13, 2021
1 parent 63dd303 commit b1e2d88
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
12 changes: 6 additions & 6 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ steps:
- name: stage-binaries
image: rancher/dapper:v0.5.4
commands:
- "Get-ChildItem -Path ./bin; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"
- "Get-ChildItem -Path ./bin; Get-ChildItem -Path ./dist; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"

- name: github_binary_release
image: plugins/github-release
Expand All @@ -31,7 +31,7 @@ steps:
- sha256
files:
- bin/wins.exe
- charts/*
- dist/rancher-wins-upgrader-*.tgz
when:
instance:
- drone-publish.rancher.io
Expand Down Expand Up @@ -115,7 +115,7 @@ steps:
- name: stage-binaries
image: rancher/dapper:v0.5.4
commands:
- "Get-ChildItem -Path ./bin; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"
- "Get-ChildItem -Path ./bin; Get-ChildItem -Path ./dist; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"

- name: docker-publish
image: plugins/docker
Expand Down Expand Up @@ -191,7 +191,7 @@ steps:
- name: stage-binaries
image: rancher/dapper:v0.5.4
commands:
- "Get-ChildItem -Path ./bin; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"
- "Get-ChildItem -Path ./bin; Get-ChildItem -Path ./dist; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"

- name: docker-publish
image: plugins/docker
Expand Down Expand Up @@ -273,7 +273,7 @@ steps:
- name: stage-binaries
image: rancher/dapper:v0.5.4
commands:
- "Get-ChildItem -Path ./bin; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"
- "Get-ChildItem -Path ./bin; Get-ChildItem -Path ./dist; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"

- name: docker-publish
image: luthermonson/drone-docker:2004
Expand Down Expand Up @@ -356,7 +356,7 @@ steps:
- name: stage-binaries
image: rancher/dapper:v0.5.4
commands:
- "Get-ChildItem -Path ./bin; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"
- "Get-ChildItem -Path ./bin; Get-ChildItem -Path ./dist; Copy-Item -Force -Path ./bin/wins.exe -Destination ./package/windows/; Get-ChildItem -Path ./package/windows"

- name: docker-publish
image: luthermonson/drone-docker:20H2
Expand Down
21 changes: 20 additions & 1 deletion Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,28 @@ RUN pushd c:\; \
\
popd;

RUN pushd c:\; \
$URL = 'https://get.helm.sh/helm-v3.5.3-windows-amd64.zip'; \
\
Write-Host ('Downloading helm from {0} ...' -f $URL); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -UseBasicParsing -OutFile c:\helm.zip -Uri $URL; \
\
Write-Host 'Expanding ...'; \
Expand-Archive -Path c:\helm.zip -DestinationPath c:\; \
\
Write-Host 'Cleaning ...'; \
Remove-Item -Force -Recurse -Path c:\helm.zip; \
\
Write-Host 'Updating PATH ...'; \
[Environment]::SetEnvironmentVariable('PATH', ('c:\helm-v3.5.3-windows-amd64\;{0}' -f $env:PATH), [EnvironmentVariableTarget]::Machine); \
\
Write-Host 'Complete.'; \
popd;

ENV DAPPER_ENV REPO TAG DRONE_TAG
ENV DAPPER_SOURCE /gopath/src/github.com/rancher/wins
ENV DAPPER_OUTPUT ./bin
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
ENV HOME ${DAPPER_SOURCE}
Expand Down
1 change: 1 addition & 0 deletions scripts/ci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $ErrorActionPreference = 'Stop'

Import-Module -WarningAction Ignore -Name "$PSScriptRoot\utils.psm1"

Invoke-Script -File "$PSScriptRoot\package-helm.ps1"
Invoke-Script -File "$PSScriptRoot\test.ps1"
Invoke-Script -File "$PSScriptRoot\build.ps1"
Invoke-Script -File "$PSScriptRoot\package.ps1"
12 changes: 12 additions & 0 deletions scripts/package-helm.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Requires -Version 5.0
$ErrorActionPreference = "Stop"

$SRC_PATH = (Resolve-Path "$PSScriptRoot\..").Path
Push-Location $SRC_PATH

Remove-Item -Path "$SRC_PATH\dist\*" -Force -ErrorAction Ignore
$null = New-Item -Type Directory -Path dist -ErrorAction Ignore

c:\windows-amd64\helm.exe package -d dist charts\rancher-wins-upgrader

Pop-Location

0 comments on commit b1e2d88

Please sign in to comment.