add gitlab-templates

This commit is contained in:
Haitao Pan 2023-02-02 11:59:40 +08:00
parent 186e1eea78
commit 05e0d5502b
4 changed files with 30 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
.DS_Store
# Binaries for programs and plugins
*.exe
*.dll

11
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,11 @@
include:
- local: 'gitlab-templates/base.yml'
- local: 'gitlab-templates/build-images.yml'
variables:
user: 'admin'
password: '${token}'
dockefile: 'alpine-with-ca.Dockerfile'
repository: 'artifact.onwalk.net/k8s'
image: 'apline'
tag: '3.13'

View File

@ -0,0 +1,6 @@
image:
name: gcr.io/kaniko-project/executor:v1.9.0-debug
entrypoint: [""]
stages:
- build

View File

@ -0,0 +1,11 @@
build-image-job:
stage: build
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{"${repository}":{\"auth\":\"$(printf "%s:%s" "${user}" "${password}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/${dockerfile}" --destination "${repository}/${image}:${tag}"
tags:
- shared
- shell
rules:
- if: $CI_COMMIT_BRANCH == "main"