代码拉取完成,页面将自动刷新
# This file is a template, and might need editing before it works on your project.
# You can copy and paste this template into a new `.gitlab-ci.yml` file.
# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
#
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Go.gitlab-ci.yml
stages:
- build
- build:docker
build:
stage: build
# golang 默认使用 debian
image: golang:1.20.3
script:
- go version
- go env -w GOPROXY=https://goproxy.cn,direct
- go mod download
- go build prometheus_webhook.go
- ./prometheus_webhook --version
artifacts:
name: "${CI_JOB_NAME}"
paths:
- prometheus_webhook
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_SERVER_HOST == 'jihulab.com'
build:debian:docker:
needs:
- job: build
artifacts: true
stage: build:docker
image: docker:latest
services:
- docker:dind
script:
- docker build -t "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-debian -f dockerfile/debian/Dockerfile .
- docker images
- docker tag "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-debian "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker push "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-debian
- docker push "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1
- docker save -o v0.0.1-debian.tar "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-debian
- docker save -o v0.0.1.tar "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1
artifacts:
name: "${CI_JOB_NAME}"
paths:
- v0.0.1-debian.tar
- v0.0.1.tar
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_SERVER_HOST == 'jihulab.com'
build:ubuntu:docker:
needs:
- job: build
artifacts: true
stage: build:docker
image: docker:latest
services:
- docker:dind
script:
- docker build -t "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-ubuntu -f dockerfile/ubuntu/Dockerfile .
- docker images
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker push "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-ubuntu
- docker save -o v0.0.1-ubuntu.tar "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-ubuntu
artifacts:
name: "${CI_JOB_NAME}"
paths:
- v0.0.1-ubuntu.tar
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_SERVER_HOST == 'jihulab.com'
build:centos7:docker:
needs:
- job: build
artifacts: true
stage: build:docker
image: docker:latest
services:
- docker:dind
script:
- docker build -t "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-centos7 -f dockerfile/centos7/Dockerfile .
- docker images
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker push "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-centos7
- docker save -o v0.0.1-centos7.tar "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-centos7
artifacts:
name: "${CI_JOB_NAME}"
paths:
- v0.0.1-centos7.tar
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_SERVER_HOST == 'jihulab.com'
build:centos8:docker:
needs:
- job: build
artifacts: true
stage: build:docker
image: docker:latest
services:
- docker:dind
script:
- docker build -t "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-centos8 -f dockerfile/centos8/Dockerfile .
- docker images
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker push "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-centos8
- docker save -o v0.0.1-centos8.tar "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-centos8
artifacts:
name: "${CI_JOB_NAME}"
paths:
- v0.0.1-centos8.tar
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_SERVER_HOST == 'jihulab.com'
build:anolisos7:docker:
needs:
- job: build
artifacts: true
stage: build:docker
image: docker:latest
services:
- docker:dind
script:
- docker build -t "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-anolisos7 -f dockerfile/anolisos7/Dockerfile .
- docker images
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker push "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-anolisos7
- docker save -o v0.0.1-anolisos7.tar "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-anolisos7
artifacts:
name: "${CI_JOB_NAME}"
paths:
- v0.0.1-anolisos7.tar
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_SERVER_HOST == 'jihulab.com'
build:anolisos8:docker:
needs:
- job: build
artifacts: true
stage: build:docker
image: docker:latest
services:
- docker:dind
script:
- docker build -t "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-anolisos8 -f dockerfile/anolisos8/Dockerfile .
- docker images
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker push "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-anolisos8
- docker save -o v0.0.1-anolisos8.tar "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-anolisos8
artifacts:
name: "${CI_JOB_NAME}"
paths:
- v0.0.1-anolisos8.tar
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_SERVER_HOST == 'jihulab.com'
build:archlinux:docker:
needs:
- job: build
artifacts: true
stage: build:docker
image: docker:latest
services:
- docker:dind
script:
- docker build -t "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-archlinux -f dockerfile/archlinux/Dockerfile .
- docker images
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker push "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-archlinux
- docker save -o v0.0.1-archlinux.tar "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-archlinux
artifacts:
name: "${CI_JOB_NAME}"
paths:
- v0.0.1-archlinux.tar
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_SERVER_HOST == 'jihulab.com'
build:fedora:docker:
needs:
- job: build
artifacts: true
stage: build:docker
image: docker:latest
services:
- docker:dind
script:
- docker build -t "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-fedora -f dockerfile/fedora/Dockerfile .
- docker images
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker push "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-fedora
- docker save -o v0.0.1-fedora.tar "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-fedora
artifacts:
name: "${CI_JOB_NAME}"
paths:
- v0.0.1-fedora.tar
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_SERVER_HOST == 'jihulab.com'
build:alpine:
stage: build
image: golang:alpine3.17
script:
- go version
- go env -w GOPROXY=https://goproxy.cn,direct
- go mod download
- go build prometheus_webhook.go
- ./prometheus_webhook --version
artifacts:
name: "${CI_JOB_NAME}"
paths:
- prometheus_webhook
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_SERVER_HOST == 'jihulab.com'
build:alpine:docker:
needs:
- job: build:alpine
artifacts: true
stage: build:docker
image: docker:latest
services:
- docker:dind
script:
- docker build -t "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-alpine -f dockerfile/alpine/Dockerfile .
- docker images
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker push "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-alpine
- docker save -o v0.0.1-alpine.tar "$DOCKER_USERNAME"/prometheus-webhook:v0.0.1-alpine
artifacts:
name: "${CI_JOB_NAME}"
paths:
- v0.0.1-alpine.tar
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_SERVER_HOST == 'jihulab.com'
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。