Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c017a87c4c | |||
| f21e5bede0 | |||
| 4896617402 | |||
| 5b9ebfb2d8 | |||
| 628f9d3ef6 | |||
| 5a95211c2f | |||
| b926404924 | |||
| 53104347c2 | |||
| 123c331889 | |||
| 9ce383cf2c | |||
| 06bf1b863c | |||
| e656306216 | |||
| 82ed33b180 | |||
| e4a1fa89fa | |||
| 66e8afd9a4 | |||
| b1e18abf75 | |||
| 5a725fd5c6 | |||
| cda07939db | |||
|
|
7533ed95ad | ||
|
|
98bb4e4ba4 | ||
|
|
e07eb1399b | ||
|
|
9a9987eeb2 |
56
.drone.yml
56
.drone.yml
@@ -1,32 +1,36 @@
|
|||||||
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: kubernetes
|
||||||
name: default
|
name: build
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- 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:
|
|
||||||
- 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
1
.gitignore
vendored
@@ -20,3 +20,4 @@
|
|||||||
.secrets
|
.secrets
|
||||||
|
|
||||||
build/*
|
build/*
|
||||||
|
**/.DS_Store
|
||||||
|
|||||||
23
Dockerfile
23
Dockerfile
@@ -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
9
Makefile
Normal 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
|
||||||
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user