Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gNMI Target
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
gNMI Target
Commits
00600b48
Commit
00600b48
authored
1 year ago
by
Malte Bauch
Browse files
Options
Downloads
Patches
Plain Diff
Add goreleaser initial setup
parent
f55e5e2a
No related branches found
No related tags found
No related merge requests found
Pipeline
#184989
failed
1 year ago
Stage: build
Stage: release
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+62
-25
62 additions, 25 deletions
.gitlab-ci.yml
.goreleaser.yml
+72
-0
72 additions, 0 deletions
.goreleaser.yml
with
134 additions
and
25 deletions
.gitlab-ci.yml
+
62
−
25
View file @
00600b48
stages
:
-
build
-
release
variables
:
IMAGE_PATH
:
"
${CI_REGISTRY_IMAGE}"
.build
:
&build
stage
:
build
image
:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:latest
services
:
-
name
:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:latest
alias
:
docker
variables
:
TAG
:
$CI_COMMIT_SHA
DOCKER_TLS_CERTDIR
:
"
/certs"
before_script
:
-
apk add git
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker login -u $CI_DEPENDENCY_PROXY_USER -p $CI_DEPENDENCY_PROXY_PASSWORD $CI_DEPENDENCY_PROXY_SERVER
-
docker context create multi-arch-build
-
docker buildx create multi-arch-build --name mybuilder --bootstrap --use
needs
:
[]
stage
:
build
image
:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:latest
services
:
-
name
:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:latest
alias
:
docker
variables
:
TAG
:
$CI_COMMIT_SHA
DOCKER_TLS_CERTDIR
:
"
/certs"
before_script
:
-
apk add git
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker login -u $CI_DEPENDENCY_PROXY_USER -p $CI_DEPENDENCY_PROXY_PASSWORD $CI_DEPENDENCY_PROXY_SERVER
-
docker context create multi-arch-build
-
docker buildx create multi-arch-build --name mybuilder --bootstrap --use
needs
:
[]
build-gnmi-target-ubuntu
:
script
:
-
TAG=${CI_COMMIT_BRANCH//\//-}
-
IMAGE_NAME="$IMAGE_PATH/ubuntu"
-
docker buildx build --provenance=false -t "$IMAGE_NAME:$TAG" -f examples/example01/target.Dockerfile --platform linux/amd64,linux/arm64 --target "ubuntu" --push --build-arg "GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/" .
<<
:
*build
script
:
-
TAG=${CI_COMMIT_BRANCH//\//-}
-
IMAGE_NAME="$IMAGE_PATH/ubuntu"
-
docker buildx build --provenance=false -t "$IMAGE_NAME:$TAG" -f examples/example01/target.Dockerfile --platform linux/amd64,linux/arm64 --target "ubuntu" --push --build-arg "GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/" .
<<
:
*build
build-gnmi-target-debian
:
script
:
-
TAG=${CI_COMMIT_BRANCH//\//-}
-
IMAGE_NAME="$IMAGE_PATH/debian"
-
docker buildx build --provenance=false -t "$IMAGE_NAME:$TAG" -f examples/example01/target.Dockerfile --platform linux/amd64,linux/arm64 --target "debian" --push --build-arg "GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/" .
<<
:
*build
script
:
-
TAG=${CI_COMMIT_BRANCH//\//-}
-
IMAGE_NAME="$IMAGE_PATH/debian"
-
docker buildx build --provenance=false -t "$IMAGE_NAME:$TAG" -f examples/example01/target.Dockerfile --platform linux/amd64,linux/arm64 --target "debian" --push --build-arg "GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/" .
<<
:
*build
release
:
stage
:
release
image
:
docker:stable
services
:
-
docker:dind
variables
:
# Optionally use GitLab's built-in image registry.
DOCKER_REGISTRY
:
$CI_REGISTRY
DOCKER_USERNAME
:
$CI_REGISTRY_USER
DOCKER_PASSWORD
:
$CI_REGISTRY_PASSWORD
# Disable shallow cloning so that goreleaser can diff between tags to
# generate a changelog.
GIT_DEPTH
:
0
# Only run this release job for tags, not every commit (for example).
only
:
refs
:
-
tags
script
:
|
# GITLAB_TOKEN is needed to create GitLab releases.
# CI_JOB_TOKEN is needed if use_job_token is set.
# DOCKER_* are needed to push Docker images.
docker run --rm --privileged \
-v $PWD:/go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \
-w /go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DOCKER_USERNAME \
-e DOCKER_PASSWORD \
-e DOCKER_REGISTRY \
-e GITLAB_TOKEN \
-e CI_JOB_TOKEN \
goreleaser/goreleaser release --clean
This diff is collapsed.
Click to expand it.
.goreleaser.yml
0 → 100644
+
72
−
0
View file @
00600b48
project_name
:
gnmi-target
# .goreleaser.yml
gitlab_urls
:
api
:
https://code.fbi.h-da.de/api/v4/
download
:
https://code.fbi.h-da.de
# set to true if you use a self-signed certificate
skip_tls_verify
:
false
# set to true if you want to upload to the Package Registry rather than attachments
# Only works with GitLab 13.5+
#
# Since: v1.3
use_package_registry
:
true
# Set this if you set GITLAB_TOKEN to the value of CI_JOB_TOKEN.
#
# Since: v1.11
use_job_token
:
true
builds
:
-
env
:
[
CGO_ENABLED=0
]
goos
:
-
linux
goarch
:
-
amd64
-
arm64
dir
:
.
main
:
./examples/example01
dockers
:
-
dockerfile
:
"
examples/example01/target.Dockerfile"
-
image_templates
:
-
"
registry.code.fbi.h-da.de/danet/gnmi-target/ubuntu:{{
.Tag
}}"
use
:
buildx
build_flag_templates
:
-
"
--provenance=false"
-
"
--platform
linux/amd64,linux/arm64"
-
'
--target
"ubuntu"'
-
"
--push"
-
'
--build-arg
"GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/"'
-
image_templates
:
-
"
registry.code.fbi.h-da.de/danet/gnmi-target/ubuntu:latest"
use
:
buildx
build_flag_templates
:
-
"
--provenance=false"
-
"
--platform
linux/amd64,linux/arm64"
-
'
--target
"ubuntu"'
-
"
--push"
-
'
--build-arg
"GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/"'
-
image_templates
:
-
"
registry.code.fbi.h-da.de/danet/gnmi-target/debian:{{
.Tag
}}"
use
:
buildx
build_flag_templates
:
-
"
--provenance=false"
-
"
--platform
linux/amd64,linux/arm64"
-
'
--target
"debian"'
-
"
--push"
-
'
--build-arg
"GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/"'
-
image_templates
:
-
"
registry.code.fbi.h-da.de/danet/gnmi-target/debian:latest"
use
:
buildx
build_flag_templates
:
-
"
--provenance=false"
-
"
--platform
linux/amd64,linux/arm64"
-
'
--target
"debian"'
-
"
--push"
-
'
--build-arg
"GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/"'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment