Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
ci-tools
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
Environments
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
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
Show more breadcrumbs
xrow-public
ci-tools
Commits
e3e1f479
Commit
e3e1f479
authored
7 months ago
by
Björn Dieding
Browse files
Options
Downloads
Patches
Plain Diff
feat: Refactor ci_container_push_build to simplify parameter handling
parent
ed201dc3
No related branches found
No related tags found
No related merge requests found
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/lib/container.sh
+3
-4
3 additions, 4 deletions
scripts/lib/container.sh
templates/container/template.yml
+1
-4
1 addition, 4 deletions
templates/container/template.yml
with
4 additions
and
8 deletions
scripts/lib/container.sh
+
3
−
4
View file @
e3e1f479
...
...
@@ -194,9 +194,8 @@ ci_container_get_release_tag() {
# 2. Is the image a release (defined by CI_RELEASE_REGISTRY_IMAGE)?
function
ci_container_push_build
()
{
ci_registry_token_login
echo
"[debug] Params:
$1
$2
"
local
latest
=
"
${
1
:-
false
}
"
local
release
=
"
${
2
:-
false
}
"
echo
"[debug] Params:
$1
"
local
release
=
"
${
1
:-
false
}
"
echo
"
$(
date
+[%T]
;
)
Container pushing."
# This is the only and first time we push CI_COMMIT_SHA
...
...
@@ -209,7 +208,7 @@ function ci_container_push_build() {
$CONTAINER_RUNTIME_PUSH
$CI_REGISTRY_IMAGE
:
$CI_CONTAINER_RELEASE_TAG
echo
"[info][tag] Pushed
$CI_REGISTRY_IMAGE
:
$CI_CONTAINER_RELEASE_TAG
"
if
[[
"
$CI_DEFAULT_BRANCH
"
==
"
$CI_COMMIT_BRANCH
"
&&
$latest
==
"true"
]]
;
then
if
[[
-v
$CI_COMMIT_TAG
&&
"
$CI_DEFAULT_BRANCH
"
==
"
$CI_COMMIT_BRANCH
"
]]
;
then
echo
"[info][latest] Pushing
$CI_REGISTRY_IMAGE
:latest"
$CONTAINER_RUNTIME
tag
$CI_REGISTRY_IMAGE
:
$CI_COMMIT_SHA
$CI_REGISTRY_IMAGE
:latest
$CONTAINER_RUNTIME_PUSH
$CI_REGISTRY_IMAGE
:latest
...
...
This diff is collapsed.
Click to expand it.
templates/container/template.yml
+
1
−
4
View file @
e3e1f479
...
...
@@ -29,9 +29,6 @@ spec:
scanning-severity
:
description
:
What level of severity should cause scanning of the built container to fail?
default
:
"
CRITICAL"
latest
:
description
:
Should the image be tagged as latest?
default
:
"
true"
release-repository-enabled
:
description
:
Should the built container image be pushed as a release?
default
:
"
false"
...
...
@@ -58,7 +55,7 @@ build:$[[ inputs.name ]]:
-
|
source <(curl -s https://$CI_SERVER_HOST/xrow-public/ci-tools/-/raw/main/scripts/library.sh)
ci_container_build $[[ inputs.path ]] $[[ inputs.name ]]
ci_container_push_build $[[
inputs.latest ]] $[[
inputs.release-repository-enabled ]]
ci_container_push_build $[[ inputs.release-repository-enabled ]]
artifacts
:
paths
:
-
release/appversion
...
...
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