18 Commits

Author SHA1 Message Date
c017a87c4c Update Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-23 18:53:35 +03:00
f21e5bede0 Update Dockerfile
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/production Build was killed
2025-08-23 18:50:38 +03:00
4896617402 Update .drone.yml
Some checks failed
continuous-integration/drone/push Build is failing
2025-08-23 18:49:56 +03:00
5b9ebfb2d8 Update Dockerfile
Some checks failed
continuous-integration/drone/push Build is failing
2025-08-23 18:49:21 +03:00
628f9d3ef6 upd
All checks were successful
continuous-integration/drone/push Build is passing
2025-06-26 21:20:53 +03:00
5a95211c2f Update Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2025-06-26 21:18:22 +03:00
b926404924 3.17
All checks were successful
continuous-integration/drone/push Build is passing
2025-04-09 16:02:07 +03:00
53104347c2 Update Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2024-12-23 18:36:49 +03:00
123c331889 Update Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2024-12-23 18:35:02 +03:00
9ce383cf2c upd
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-21 20:54:41 +03:00
06bf1b863c Update Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2024-02-20 19:50:00 +03:00
e656306216 Update Dockerfile
Some checks failed
continuous-integration/drone/push Build is failing
2024-02-20 19:48:58 +03:00
82ed33b180 Update .drone.yml
All checks were successful
continuous-integration/drone/push Build is passing
2024-02-20 19:46:38 +03:00
e4a1fa89fa Update .drone.yml
Some checks failed
continuous-integration/drone/push Build is failing
2024-02-20 19:43:22 +03:00
66e8afd9a4 Update .drone.yml
Some checks failed
continuous-integration/drone/push Build encountered an error
2024-02-20 19:40:31 +03:00
b1e18abf75 Update .drone.yml
Some checks failed
continuous-integration/drone/push Build encountered an error
2024-02-20 19:39:28 +03:00
5a725fd5c6 Update .drone.yml 2024-02-20 19:39:18 +03:00
cda07939db new helm 2024-02-20 19:37:18 +03:00
5 changed files with 59 additions and 38 deletions

View File

@@ -1,35 +1,36 @@
---
kind: pipeline kind: pipeline
type: docker type: kubernetes
name: default name: build
platform: trigger:
os: linux branch:
arch: amd64 - master
clone:
# disable: true
depth: 1
image_pull_secrets:
- dockerconfig
steps: steps:
- name: test
image: golang:1.13
commands:
- go test ./cmd/... ./internal/...
- go vet ./cmd/... ./internal/...
- name: lint
image: cytopia/golint
commands:
- golint -set_exit_status ./cmd/... ./internal/...
- name: build
image: golang:1.13
commands:
- GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o build/drone-helm cmd/drone-helm/main.go
- name: publish_linux_amd64 - name: publish_linux_amd64
image: plugins/docker image: harbor.1sept.ru/drone/drone-kaniko
settings: settings:
auto_tag: true registry: harbor.1sept.ru
username: repo: drone/drone-helm3
from_secret: docker_username cache: false
password: tags:
from_secret: docker_password - git-${DRONE_COMMIT_SHA:0:7}
repo: - latest
from_secret: plugin_repo username:
dockerfile: Dockerfile from_secret: harbor-username
when: password:
event: [ tag, push ] from_secret: harbor-password
---
kind: signature
hmac: ab275b41f1621072152d6e85b5f94289be8dda38debd2a177e0f666960491c6e
...

1
.gitignore vendored
View File

@@ -20,3 +20,4 @@
.secrets .secrets
build/* build/*
**/.DS_Store

View File

@@ -1,10 +1,19 @@
FROM alpine/helm:3.8.1 FROM golang:1.24-alpine3.21 AS builder
MAINTAINER Joachim Hill-Grannec <joachim@pelo.tech>
COPY build/drone-helm /bin/drone-helm ENV GO111MODULE=on
COPY assets/kubeconfig.tpl /root/.kube/config.tpl WORKDIR /app
LABEL description="Helm 3 plugin for Drone 3" COPY --link go.mod .
LABEL base="alpine/helm" COPY --link go.sum .
RUN go mod download
COPY --link . .
ENTRYPOINT [ "/bin/drone-helm" ] RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /go/bin/drone-helm ./cmd/drone-helm
# --- Copy the cli to an image with helm already installed ---
FROM alpine/helm:3.18.5
COPY --link --from=builder /go/bin/drone-helm /bin/drone-helm
COPY --link ./assets/kubeconfig.tpl /root/.kube/config.tpl
ENTRYPOINT [ "/bin/drone-helm" ]

9
Makefile Normal file
View File

@@ -0,0 +1,9 @@
help:
@echo "make check - Check Dockerfile syntax"
@echo "make drone-sign - Sign Drone config file"
check:
docker build --check .
drone-sign: ## Envs DRONE_SERVER & DRONE_TOKEN needed
drone sign --save 1sept/drone-helm3

View File

@@ -3,10 +3,11 @@ package run
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/pelotech/drone-helm3/internal/env"
"io" "io"
"os" "os"
"text/template" "text/template"
"github.com/pelotech/drone-helm3/internal/env"
) )
// InitKube is a step in a helm Plan that initializes the kubernetes config file. // InitKube is a step in a helm Plan that initializes the kubernetes config file.
@@ -87,7 +88,7 @@ func (i *InitKube) Prepare() error {
fmt.Fprintf(i.stderr, "kubeconfig file at %s\n", i.configFilename) fmt.Fprintf(i.stderr, "kubeconfig file at %s\n", i.configFilename)
} }
i.configFile, err = os.Create(i.configFilename) i.configFile, err = os.OpenFile(i.configFilename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil { if err != nil {
return fmt.Errorf("could not open kubeconfig file for writing: %w", err) return fmt.Errorf("could not open kubeconfig file for writing: %w", err)
} }