Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jekyll_container
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Calyx Institute
Containers
jekyll_container
Commits
c5fe9efc
Commit
c5fe9efc
authored
Apr 12, 2022
by
micah
Browse files
Options
Downloads
Patches
Plain Diff
Add .gitlab-ci.yml
parent
33013655
No related branches found
No related tags found
No related merge requests found
Pipeline
#85474
passed
Apr 12, 2022
Stage: build
Stage: release
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+77
-0
77 additions, 0 deletions
.gitlab-ci.yml
with
77 additions
and
0 deletions
.gitlab-ci.yml
0 → 100644
+
77
−
0
View file @
c5fe9efc
stages
:
-
build
-
release
variables
:
IMAGE_TAG
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
RELEASE_TAG
:
$CI_REGISTRY_IMAGE:latest
PREVIOUS_RELEASE_TAG
:
$CI_REGISTRY_IMAGE:previous
DOCKER_DRIVER
:
overlay2
.docker_job_template
:
&docker_job
image
:
docker:stable
services
:
-
name
:
docker:dind
alias
:
docker
tags
:
-
DIND
before_script
:
-
if [ -n "$TRIGGERED_USER" ] && [ -n "$TRIGGER_SOURCE" ]; then
echo "Pipeline triggered by $TRIGGERED_USER at $TRIGGER_SOURCE";
fi
-
echo -n "$CI_JOB_TOKEN" | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY
build
:
<<
:
*docker_job
stage
:
build
script
:
-
>
docker build
--pull
--build-arg ci_token=$CI_JOB_TOKEN
--build-arg ci_commit_sha=$CI_COMMIT_SHORT_SHA
${BUILD_DEB_APT_PROXY:+--build-arg http_proxy=http://${BUILD_DEB_APT_PROXY}}
--cache-from $RELEASE_TAG
--label "org.opencontainers.image.title=$CI_PROJECT_TITLE"
--label "org.opencontainers.image.url=$CI_PROJECT_URL"
--label "org.opencontainers.image.created=$CI_JOB_STARTED_AT"
--label "org.opencontainers.image.revision=$CI_COMMIT_SHA"
--label "org.opencontainers.image.version=$CI_COMMIT_REF_NAME"
-t $IMAGE_TAG
.
-
docker push $IMAGE_TAG
release
:
<<
:
*docker_job
stage
:
release
variables
:
GIT_STRATEGY
:
none
script
:
# Update PREVIOUS_RELEASE_TAG and commit new RELEASE_TAG
-
docker pull $RELEASE_TAG ||
true
-
docker tag $RELEASE_TAG $PREVIOUS_RELEASE_TAG ||
true
-
docker push $PREVIOUS_RELEASE_TAG ||
true
-
docker pull $IMAGE_TAG
-
docker tag $IMAGE_TAG $RELEASE_TAG
-
docker push $RELEASE_TAG
only
:
-
main
trivy
:
<<
:
*docker_job
stage
:
build
needs
:
[
build
]
allow_failure
:
true
script
:
-
export TRIVY_VERSION=$(wget -qO - "https://api.github.com/repos/aquasecurity/trivy/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
-
echo $TRIVY_VERSION
-
wget --no-verbose https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz -O - | tar -zxvf -
-
./trivy --cache-dir .trivycache/ --format template --template "@contrib/gitlab-codequality.tpl" -o gl-codequality.json $IMAGE_TAG ||
true
cache
:
paths
:
-
.trivycache/
artifacts
:
paths
:
-
gl-codequality.json
reports
:
codequality
:
gl-codequality.json
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