Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm upgrade #109

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,20 @@ RUN go build
# ------ Drone-Helm plugin image ------
#
FROM alpine:3.9 as final
MAINTAINER Ivan Pedrazas <[email protected]>

COPY --from=builder /go/src/github.com/ipedrazas/drone-helm/drone-helm /bin/

# Helm version: can be passed at build time
ARG VERSION
ENV VERSION ${VERSION:-v2.14.1}
ENV VERSION ${VERSION:-v3.4.2}
ENV FILENAME helm-${VERSION}-linux-amd64.tar.gz

ARG KUBECTL
ENV KUBECTL ${KUBECTL:-v1.14.3}
ENV KUBECTL ${KUBECTL:-v1.21.0}

RUN set -ex \
&& apk add --no-cache curl ca-certificates \
&& curl -o /tmp/${FILENAME} http://storage.googleapis.com/kubernetes-helm/${FILENAME} \
&& curl -o /tmp/${FILENAME} https://get.helm.sh/${FILENAME} \
&& curl -o /tmp/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL}/bin/linux/amd64/kubectl \
&& curl -o /tmp/aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/aws-iam-authenticator \
&& tar -zxvf /tmp/${FILENAME} -C /tmp \
Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Drone helm MoneySmart
This is a forked repository from https://github.com/ipedrazas/drone-helm
The image built is used in drone tasks to deploy helm charts to EKS.

Two changes have been introduced to the base repo
1. The Helm version has been hardcoded to use version 2.11
2. The stable repo url default value has been set to "https://charts.helm.sh/stable" since helm version needs updating for the [actual fix](https://github.com/hashicorp/terraform-provider-helm/issues/649) for this.

Image has been built and pushed to [dockerhub](https://hub.docker.com/repository/docker/moneysmartco/drone-helm) manually.

To build and upload image run
```
docker build -t moneysmartco/drone-helm:tag-name
docker push moneysmartco/drone-helm:tag-name
```

# Helm (Kubernetes) plugin for drone.io

[![Build Status](https://cloud.drone.io/api/badges/ipedrazas/drone-helm/status.svg)](https://cloud.drone.io/ipedrazas/drone-helm)
Expand All @@ -8,8 +24,8 @@

This plugin allows to deploy a [Helm](https://github.com/kubernetes/helm) chart into a [Kubernetes](https://github.com/kubernetes/kubernetes) cluster.

* Current `helm` version: 2.14.1
* Current `kubectl` version: 1.14.3
* Current `helm` version: 3.4.2
* Current `kubectl` version: 1.21.0

## Drone Pipeline Usage

Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ func main() {
},
cli.StringFlag{
Name: "stable_repo_url",
Usage: "URL for stable repository (default 'https://kubernetes-charts.storage.googleapis.com')",
Usage: "URL for stable repository (default 'https://charts.helm.sh/stable')",
Value: "https://charts.helm.sh/stable",
EnvVar: "PLUGIN_STABLE_REPO_URL,STABLE_REPO_URL",
},
}
Expand Down
15 changes: 8 additions & 7 deletions plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func setUpgradeCommand(p *Plugin) {
if p.Config.Namespace != "" {
upgrade = append(upgrade, "--namespace")
upgrade = append(upgrade, p.Config.Namespace)
upgrade = append(upgrade, "--create-namespace")
}
if p.Config.TillerNs != "" {
upgrade = append(upgrade, "--tiller-namespace")
Expand Down Expand Up @@ -292,11 +293,11 @@ func (p *Plugin) Exec() error {
p.debug()
}

init := doHelmInit(p)
err := runCommand(init)
if err != nil {
return fmt.Errorf("Error running helm command: " + strings.Join(init[:], " "))
}
// init := doHelmInit(p)
// err := runCommand(init)
// if err != nil {
// return fmt.Errorf("Error running helm command: " + strings.Join(init[:], " "))
// }

if len(p.Config.HelmRepos) > 0 {
for _, repo := range p.Config.HelmRepos {
Expand All @@ -316,7 +317,7 @@ func (p *Plugin) Exec() error {
}

if p.Config.UpdateDependencies {
if err = runCommand(doDependencyUpdate(p.Config.Chart)); err != nil {
if err := runCommand(doDependencyUpdate(p.Config.Chart)); err != nil {
return fmt.Errorf("Error updating dependencies: " + err.Error())
}
}
Expand All @@ -327,7 +328,7 @@ func (p *Plugin) Exec() error {
log.Println("helm command: " + strings.Join(p.command, " "))
}

err = runCommand(p.command)
var err = runCommand(p.command)
if err != nil {
return fmt.Errorf("Error running helm command: " + strings.Join(p.command[:], " "))
}
Expand Down