Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
ubuntu_20_04
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
HZB
EPICS
base
ubuntu_20_04
Commits
6b1de941
Commit
6b1de941
authored
1 year ago
by
(INACTIVE) Marcel Bajdel (new marcel.bajdel)
Browse files
Options
Downloads
Patches
Plain Diff
changes to pipeline
parent
89553925
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!20
Release
,
!13
Docker image branch
,
!12
Docker image branch
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+23
-39
23 additions, 39 deletions
.gitlab-ci.yml
with
23 additions
and
39 deletions
.gitlab-ci.yml
+
23
−
39
View file @
6b1de941
...
...
@@ -3,10 +3,9 @@ stages:
-
build_branch
# builds if the image does not exist
-
branch_scan
# Check whether the image is already existing or not for the tag
-
check_image_tag
# Check whether there are any vulnerabilities in the image
-
build_main
# builds when the merge request is made into main
-
build_tag
# builds when the tag is pushed
-
test_main
# tests when the merge request is made into main
-
build_develop
# builds when the merge request is made into development branch
-
test_latest
# tests when the image with tag latest is pushed
-
build_tag
# builds when the tag is pushed
-
test_tag
# tests when the tag is pushed
build_branch
:
...
...
@@ -41,7 +40,7 @@ branch_scan:
script
:
-
mkdir scan_result
-
cd tar_images
-
trivy image --timeout 15m --offline-scan --input $CI_COMMIT_BRANCH -f json -o ../scan_result/$CI_COMMIT_BRANCH.json --severity CRITICAL
-
trivy image --timeout 15m --offline-scan --input $CI_COMMIT_BRANCH
.tar
-f json -o ../scan_result/$CI_COMMIT_BRANCH.json --severity CRITICAL
artifacts
:
paths
:
-
scan_result
...
...
@@ -76,8 +75,8 @@ check_image_tag: # Check whether the image is already existing or not for the ta
build_
main
:
# This build will run only for main branch
stage
:
build_
main
build_
develop
:
# This build will run only for main branch
stage
:
build_
develop
image
:
name
:
gcr.io/kaniko-project/executor:debug
entrypoint
:
[
"
"
]
...
...
@@ -87,7 +86,25 @@ build_main: # This build will run only for main branch
# build the image with tag latest if the merge request is made into main
-
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"develop"'
-
if
:
'
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
"develop"'
test_latest
:
# This test will run only for tag latest
stage
:
test_latest
image
:
name
:
gcr.io/go-containerregistry/crane:debug
entrypoint
:
[
"
"
]
script
:
# specify auths for crane executor
-
crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# validate the image with tag latest
-
if ! crane validate --remote $CI_REGISTRY_IMAGE:latest; then exit 1; fi > test_latest.log
artifacts
:
paths
:
-
test_latest.log
rules
:
-
if
:
'
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
"main"'
-
if
:
'
$CI_COMMIT_BRANCH
==
"develop"'
build_tag
:
# This build will run only for tags
stage
:
build_tag
...
...
@@ -104,39 +121,6 @@ build_tag: # This build will run only for tags
# if the image does not exist, build it with the added tag
-
if [ "$DOCKER_LATEST_IMAGE_EXISTS" == "false" ]; then /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME; else echo "Docker image already exists"; fi
test_main
:
stage
:
test_main
image
:
name
:
gcr.io/go-containerregistry/crane:debug
entrypoint
:
[
"
"
]
rules
:
# test only if the merge request is made into main
-
if
:
'
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
"main"'
script
:
# specify auths for crane executor
-
if DOCKER_TAG_IMAGE_EXISTS=true; then echo "Docker image already exists"; else crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY; fi
# validate the image with tag latest
-
if ! crane validate --remote $CI_REGISTRY_IMAGE:latest; then exit 1; fi > test_main.log
artifacts
:
paths
:
-
test_main.log
test_latest
:
# This test will run only for tag latest
stage
:
test_latest
image
:
name
:
gcr.io/go-containerregistry/crane:debug
entrypoint
:
[
"
"
]
script
:
# specify auths for crane executor
-
if [ "$DOCKER_LATEST_IMAGE_EXISTS" == "false" ]; then echo "Docker image already exists"; else crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY; fi
# validate the image with tag latest
-
if ! crane validate --remote $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH; then exit 1; fi > test_latest.log
artifacts
:
paths
:
-
test_latest.log
rules
:
-
if
:
'
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
"main"'
when
:
never
test_tag
:
# This test will run only for tags
stage
:
test_tag
image
:
...
...
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