66 lines
2.2 KiB
YAML
66 lines
2.2 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: default
|
|
|
|
steps:
|
|
- name: go-test
|
|
image: cache.coadcorp.com/library/golang
|
|
commands:
|
|
- go mod download
|
|
- go test ./...
|
|
|
|
- name: go-build
|
|
image: cache.coadcorp.com/library/golang
|
|
commands:
|
|
- XTEVE_VERSION="$(head -n 1 changelog-beta.md)"
|
|
- XTEVE_VERSION="${XTEVE_VERSION#\#\#\#\# }"
|
|
- XTEVE_VERSION="${XTEVE_VERSION%% *}"
|
|
- XTEVE_VERSION="${XTEVE_VERSION%-beta}"
|
|
- SOURCE_VERSION_LINE="$(grep -m1 'Version = ' xteve.go)"
|
|
- SOURCE_VERSION="${SOURCE_VERSION_LINE#*\"}"
|
|
- SOURCE_VERSION="${SOURCE_VERSION%%\"*}"
|
|
- test -n "${XTEVE_VERSION}" || (echo "Could not parse version from changelog-beta.md" && exit 1)
|
|
- test -n "${SOURCE_VERSION}" || (echo "Could not parse source version from xteve.go" && exit 1)
|
|
- 'test "${SOURCE_VERSION}" = "${XTEVE_VERSION}" || (echo "Version mismatch changelog=${XTEVE_VERSION} source=${SOURCE_VERSION}" && exit 1)'
|
|
- echo "Building xTeVe version ${XTEVE_VERSION} from changelog-beta.md"
|
|
- go build -v -ldflags "-X main.Version=${XTEVE_VERSION}" ./...
|
|
|
|
- name: dockerfile-lint
|
|
image: cache.coadcorp.com/library/hadolint/hadolint:v2.12.0-alpine
|
|
commands:
|
|
- hadolint -t error Dockerfile
|
|
|
|
- name: compose-validate
|
|
image: cache.coadcorp.com/library/docker:27-cli
|
|
commands:
|
|
- apk add --no-cache docker-cli-compose
|
|
- docker compose -f docker-compose.yml config -q
|
|
- docker compose -f docker-compose.host.yml config -q
|
|
|
|
- name: docker-build-validate
|
|
image: gcr.io/kaniko-project/executor:v1.23.2-debug
|
|
commands:
|
|
- /kaniko/executor --context "${DRONE_WORKSPACE}" --dockerfile "${DRONE_WORKSPACE}/Dockerfile" --no-push --destination xteve:validate --build-arg TARGETOS=linux --build-arg TARGETARCH=amd64
|
|
when:
|
|
event:
|
|
- pull_request
|
|
|
|
- name: docker-publish
|
|
image: plugins/docker
|
|
settings:
|
|
registry: registry.coadcorp.com
|
|
repo: registry.coadcorp.com/nathan/xteve
|
|
dockerfile: Dockerfile
|
|
username: nathan
|
|
password:
|
|
from_secret: registry_password
|
|
tags:
|
|
- latest
|
|
- ${DRONE_COMMIT_SHA}
|
|
build_args:
|
|
- TARGETOS=linux
|
|
- TARGETARCH=amd64
|
|
when:
|
|
event:
|
|
- push
|