Init pipeline (#3)
This commit is contained in:
parent
a02ccc0680
commit
7afb9b9b04
7 changed files with 150 additions and 7 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -10,3 +10,7 @@
|
||||||
|
|
||||||
# kaniko base image cache files
|
# kaniko base image cache files
|
||||||
sha256:*
|
sha256:*
|
||||||
|
|
||||||
|
# ide files
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
|
44
.pre-commit-config.yaml
Normal file
44
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
repos:
|
||||||
|
- repo: meta
|
||||||
|
hooks:
|
||||||
|
- id: check-hooks-apply
|
||||||
|
- id: check-useless-excludes
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.5.0
|
||||||
|
hooks:
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- repo: https://github.com/mrtazz/checkmake
|
||||||
|
rev: 0.2.2
|
||||||
|
hooks:
|
||||||
|
- id: checkmake
|
||||||
|
- repo: https://github.com/hadolint/hadolint
|
||||||
|
rev: v2.12.1-beta
|
||||||
|
hooks:
|
||||||
|
- id: hadolint
|
||||||
|
- repo: https://github.com/adrienverge/yamllint.git
|
||||||
|
rev: v1.33.0
|
||||||
|
hooks:
|
||||||
|
- id: yamllint
|
||||||
|
args: [--strict, -c=.yamllint.yaml]
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: yaml-file-extension
|
||||||
|
name: Check if YAML files has *.yaml extension.
|
||||||
|
entry: YAML filenames must have .yaml extension.
|
||||||
|
language: fail
|
||||||
|
files: .yml$
|
||||||
|
exclude: '^.gitpod.yml$'
|
||||||
|
|
||||||
|
ci:
|
||||||
|
autofix_commit_msg: |
|
||||||
|
[pre-commit.ci] auto fixes from pre-commit.com hooks [CI SKIP]
|
||||||
|
|
||||||
|
for more information, see https://pre-commit.ci
|
||||||
|
autofix_prs: true
|
||||||
|
autoupdate_branch: ''
|
||||||
|
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
|
||||||
|
autoupdate_schedule: monthly
|
||||||
|
# NB: hadolint not included in pre-commit.ci
|
||||||
|
skip: [check-hooks-apply, check-useless-excludes, hadolint]
|
||||||
|
submodules: false
|
14
.woodpecker/release.yaml
Normal file
14
.woodpecker/release.yaml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
when:
|
||||||
|
event: push
|
||||||
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
release:
|
||||||
|
image: woodpeckerci/plugin-ready-release-go:1.0.3
|
||||||
|
pull: true
|
||||||
|
settings:
|
||||||
|
release_branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
forge_type: github
|
||||||
|
git_email: woodpecker-bot@obermui.de
|
||||||
|
github_token:
|
||||||
|
from_secret: GITHUB_TOKEN
|
72
.woodpecker/test-release.yaml
Normal file
72
.woodpecker/test-release.yaml
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
- event: tag
|
||||||
|
- event: push
|
||||||
|
branch:
|
||||||
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
- renovate/*
|
||||||
|
|
||||||
|
variables:
|
||||||
|
- &platforms 'linux/amd64,linux/arm64,linux/s390x'
|
||||||
|
# vars used on push / tag events only
|
||||||
|
- publish_logins: &publish_logins
|
||||||
|
# Default DockerHub login
|
||||||
|
- registry: https://index.docker.io/v1/
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
# Additional Quay.IO login
|
||||||
|
- registry: https://quay.io
|
||||||
|
username:
|
||||||
|
from_secret: QUAY_IO_USER
|
||||||
|
password:
|
||||||
|
from_secret: QUAY_IO_TOKEN
|
||||||
|
- &publish_repos 'docker.io/woodpeckerci/plugin-kaniko,quay.io/woodpeckerci/plugin-kaniko'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
lint:
|
||||||
|
image: alpine:3.19
|
||||||
|
commands:
|
||||||
|
- apk add -U shellcheck
|
||||||
|
- shellcheck -e SC3040 -e SC3010 -e SC3037 -e SC2086 -e SC2166 -e SC2002 -e SC2236 -e SC3020 -e SC2162 *.sh
|
||||||
|
|
||||||
|
# TODO: add test of fresh build kaniko
|
||||||
|
|
||||||
|
build-dryrun:
|
||||||
|
image: woodpeckerci/plugin-docker-buildx:2.3.0
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
settings:
|
||||||
|
repo: test/repo
|
||||||
|
dry_run: true
|
||||||
|
platforms: *platforms
|
||||||
|
tags: latest
|
||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
- event: push
|
||||||
|
branch: renovate/*
|
||||||
|
|
||||||
|
release-next:
|
||||||
|
image: woodpeckerci/plugin-docker-buildx:2.3.0
|
||||||
|
settings:
|
||||||
|
repo: *publish_repos
|
||||||
|
platforms: *platforms
|
||||||
|
tags: next
|
||||||
|
logins: *publish_logins
|
||||||
|
when:
|
||||||
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
event: push
|
||||||
|
|
||||||
|
release-tag:
|
||||||
|
image: woodpeckerci/plugin-docker-buildx:2.3.0
|
||||||
|
depends_on: vendor
|
||||||
|
settings:
|
||||||
|
repo: *publish_repos
|
||||||
|
platforms: *platforms
|
||||||
|
auto_tag: true
|
||||||
|
# remove line below if you can read it on a release branch and it's not the latest release branch
|
||||||
|
tags: latest
|
||||||
|
logins: *publish_logins
|
||||||
|
when:
|
||||||
|
event: tag
|
9
.yamllint.yaml
Normal file
9
.yamllint.yaml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
extends: default
|
||||||
|
|
||||||
|
ignore-from-file:
|
||||||
|
- .gitignore
|
||||||
|
|
||||||
|
rules:
|
||||||
|
line-length: disable
|
||||||
|
document-start: disable
|
||||||
|
comments: disable
|
10
README.md
10
README.md
|
@ -58,15 +58,15 @@ steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: golang
|
image: golang
|
||||||
commands:
|
commands:
|
||||||
- go get
|
- go get
|
||||||
- go build
|
- go build
|
||||||
- make versiontags > .tags
|
- make versiontags > .tags
|
||||||
- name: publish
|
- name: publish
|
||||||
image: banzaicloud/drone-kaniko
|
image: banzaicloud/drone-kaniko
|
||||||
settings:
|
settings:
|
||||||
registry: registry.example.com
|
registry: registry.example.com
|
||||||
repo: registry.example.com/example-project
|
repo: registry.example.com/example-project
|
||||||
# tags: ${DRONE_COMMIT_SHA} <= it must be left undefined
|
# tags: ${DRONE_COMMIT_SHA} <= it must be left undefined
|
||||||
username:
|
username:
|
||||||
from_secret: docker-username
|
from_secret: docker-username
|
||||||
password:
|
password:
|
||||||
|
@ -85,12 +85,12 @@ steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: golang
|
image: golang
|
||||||
commands:
|
commands:
|
||||||
- go get
|
- go get
|
||||||
- go build
|
- go build
|
||||||
- name: publish
|
- name: publish
|
||||||
image: banzaicloud/drone-kaniko
|
image: banzaicloud/drone-kaniko
|
||||||
settings:
|
settings:
|
||||||
registry: registry.example.com
|
registry: registry.example.com
|
||||||
repo: registry.example.com/example-project
|
repo: registry.example.com/example-project
|
||||||
auto_tag: true # higher priority then .tags file
|
auto_tag: true # higher priority then .tags file
|
||||||
# tags: ${DRONE_COMMIT_SHA} <= it must be left undefined to use auto_tag
|
# tags: ${DRONE_COMMIT_SHA} <= it must be left undefined to use auto_tag
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
export PATH=$PATH:/kaniko/
|
export PATH="$PATH:/kaniko/"
|
||||||
|
|
||||||
REGISTRY=${PLUGIN_REGISTRY:-index.docker.io}
|
REGISTRY=${PLUGIN_REGISTRY:-index.docker.io}
|
||||||
|
|
||||||
if [ "${PLUGIN_USERNAME:-}" ] || [ "${PLUGIN_PASSWORD:-}" ]; then
|
if [ "${PLUGIN_USERNAME:-}" ] || [ "${PLUGIN_PASSWORD:-}" ]; then
|
||||||
DOCKER_AUTH=`echo -n "${PLUGIN_USERNAME}:${PLUGIN_PASSWORD}" | base64 | tr -d "\n"`
|
DOCKER_AUTH=$(echo -n "${PLUGIN_USERNAME}:${PLUGIN_PASSWORD}" | base64 | tr -d "\n")
|
||||||
|
|
||||||
cat > /kaniko/.docker/config.json <<DOCKERJSON
|
cat > /kaniko/.docker/config.json <<DOCKERJSON
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue