Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Common CI Configuration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
hive
Common CI Configuration
Commits
fa5530f8
Verified
Commit
fa5530f8
authored
2 years ago
by
Konrad Botor
Browse files
Options
Downloads
Patches
Plain Diff
Updated definition of job .build_docker_image - ref.
hive#406
parent
8d2e47e2
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Custom docker containers containing required bash scripts
Pipeline
#57084
passed
2 years ago
Stage: validation
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+11
-11
11 additions, 11 deletions
.gitlab-ci.yml
with
11 additions
and
11 deletions
.gitlab-ci.yml
+
11
−
11
View file @
fa5530f8
...
...
@@ -68,21 +68,21 @@ lint_python_scripts:
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script
:
-
tag=""
-
|
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
docker build --target $BUILD_TARGET --pull -t "$CI_REGISTRY_IMAGE/$BUILD_TARGET:latest" .
docker push "$CI_REGISTRY_IMAGE/$BUILD_TARGET:latest"
tag=":latest"
else
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
tag=":$CI_COMMIT_REF_SLUG"
fi
if [[ "$CI_COMMIT_BRANCH" == "main" ]]; then
echo "Running on main branch: tag = 'main-latest'"
docker build --target $BUILD_TARGET --pull -t "$CI_REGISTRY_IMAGE/$BUILD_TARGET:main-latest" .
docker push "$CI_REGISTRY_IMAGE/$BUILD_TARGET:main-latest"
fi
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
docker build --target $BUILD_TARGET --pull -t "$CI_REGISTRY_IMAGE/$BUILD_TARGET${tag}" .
docker push "$CI_REGISTRY_IMAGE/$BUILD_TARGET${tag}"
-
|
docker build --target $BUILD_TARGET --pull \
-t "$CI_REGISTRY_IMAGE/$BUILD_TARGET${tag}" \
-t "$CI_REGISTRY_IMAGE/$BUILD_TARGET:$CI_COMMIT_SHA" .
-
docker push "$CI_REGISTRY_IMAGE/$BUILD_TARGET${tag}"
-
docker push "$CI_REGISTRY_IMAGE/$BUILD_TARGET:$CI_COMMIT_SHA"
rules
:
-
if
:
$CI_COMMIT_BRANCH
exists
:
...
...
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