Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dockerfiles
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Picasoft
Technique
Dockerfiles
Commits
1b70f6ee
Commit
1b70f6ee
authored
6 years ago
by
Igor Witz
Browse files
Options
Downloads
Patches
Plain Diff
Update get-modified-image.sh, .gitlab-ci.yml files
parent
e16314e6
No related branches found
Branches containing commit
No related tags found
1 merge request
!22
Ajout de la CI pour Etherpad et Dokuwiki
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+91
-0
91 additions, 0 deletions
.gitlab-ci.yml
get-modified-image.sh
+2
-1
2 additions, 1 deletion
get-modified-image.sh
with
93 additions
and
1 deletion
.gitlab-ci.yml
0 → 100644
+
91
−
0
View file @
1b70f6ee
image
:
docker:stable
services
:
-
docker:dind
stages
:
-
build
-
static_tests
-
dynamic_tests
build
:
stage
:
build
before_script
:
-
echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USERNAME --password-stdin
-
apk update
-
apk add git
-
chmod +x get-modified-image.sh
-
export MODIFIED_IMAGE_FULL=$(./get-modified-image.sh)
-
export MODIFIED_IMAGE=$(echo $MODIFIED_IMAGE_FULL | cut -d ':' -f1)
-
echo -e "Building container $MODIFIED_IMAGE"
script
:
-
docker build -f $MODIFIED_IMAGE/Dockerfile $MODIFIED_IMAGE -t $REGISTRY/ci-builds/$CI_COMMIT_SHA
-
docker push $REGISTRY/ci-builds/$CI_COMMIT_SHA
after_script
:
-
docker logout $REGISTRY
tags
:
[
build
]
only
:
changes
:
-
pica-etherpad/*
clair
:
stage
:
static_tests
before_script
:
-
echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USERNAME --password-stdin
-
docker pull $REGISTRY/ci-builds/$CI_COMMIT_SHA:latest
-
apk update
-
apk add git
-
chmod +x get-modified-image.sh
-
export MODIFIED_IMAGE_FULL=$(./get-modified-image.sh)
-
export MODIFIED_IMAGE=$(echo $MODIFIED_IMAGE_FULL | cut -d ':' -f1)
-
echo -e "Performing static analysis for container $MODIFIED_IMAGE"
script
:
-
docker run -d --name db arminc/clair-db:latest
-
docker run -p 6060:6060 -d --link db:postgres --name clair --restart on-failure arminc/clair-local-scan:v2.0.6
-
wget https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64
-
mv clair-scanner_linux_amd64 clair-scanner
-
chmod +x clair-scanner
-
echo "Waiting for Clair daemon to start"
-
while( ! wget -q -O /dev/null http://docker:6060/v1/namespaces ) ; do sleep 1 ; done
-
./clair-scanner -c http://docker:6060 --ip $(hostname -i) -r clair-report.json -l clair.log -w $MODIFIED_IMAGE/clair-whitelist.yml --threshold="High" $REGISTRY/ci-builds/$CI_COMMIT_SHA
artifacts
:
paths
:
-
clair-report.json
-
clair.log
after_script
:
-
docker logout $REGISTRY
tags
:
[
build
]
only
:
changes
:
-
pica-etherpad/*
allow_failure
:
false
docker-bench-security
:
stage
:
dynamic_tests
before_script
:
-
apk update
-
apk add wget py-pip git iproute2
-
pip install docker-compose
-
chmod +x get-modified-image.sh
-
export MODIFIED_IMAGE_FULL=$(./get-modified-image.sh)
-
export MODIFIED_IMAGE=$(echo $MODIFIED_IMAGE_FULL | cut -d ':' -f1)
-
sed -i -e "s/$MODIFIED_IMAGE_FULL/$REGISTRY\/ci-builds\/$CI_COMMIT_SHA:latest/g" pica-etherpad/docker-compose.yml
-
echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USERNAME --password-stdin
-
docker pull $REGISTRY/ci-builds/$CI_COMMIT_SHA:latest
script
:
-
if [[ -d $MODIFIED_IMAGE/secrets ]]; then for i in $MODIFIED_IMAGE/secrets/* ; do cp $i $(echo $i| cut -d '.' -f1,2); done; fi;
-
cd $MODIFIED_IMAGE
-
docker-compose up -d
-
git clone https://github.com/docker/docker-bench-security.git
-
cd docker-bench-security
-
sh docker-bench-security.sh -c container_images,container_runtime,docker_security_operations -e check_5_12,check_4_1 -l ../../report.txt
artifacts
:
paths
:
-
report.txt
after_script
:
-
docker logout $REGISTRY
tags
:
[
build
]
only
:
changes
:
-
pica-etherpad/*
allow_failure
:
true
This diff is collapsed.
Click to expand it.
get-modified-image.sh
+
2
−
1
View file @
1b70f6ee
...
@@ -9,4 +9,5 @@ for i in $(git diff-tree --no-commit-id --name-only $CI_COMMIT_SHA); do
...
@@ -9,4 +9,5 @@ for i in $(git diff-tree --no-commit-id --name-only $CI_COMMIT_SHA); do
RES
=
$i
RES
=
$i
fi
fi
done
done
echo
$RES
RES
=
$(
cat
$RES
/docker-compose.yml |
grep
image: |
head
-n1
|
cut
-d
':'
-f2-
)
echo
$RES
\ No newline at end of file
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