Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ansible
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
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tools
Docker
Ansible
Commits
a7a1c425
Commit
a7a1c425
authored
Apr 9, 2020
by
Dmitriy Safronov
Browse files
Options
Downloads
Patches
Plain Diff
Initial
parent
1b56e53a
No related branches found
No related tags found
No related merge requests found
Pipeline
#100
passed
Apr 9, 2020
Stage: build
Stage: test
Stage: release
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+67
-0
67 additions, 0 deletions
.gitlab-ci.yml
Dockerfile
+9
-0
9 additions, 0 deletions
Dockerfile
with
76 additions
and
0 deletions
.gitlab-ci.yml
0 → 100644
+
67
−
0
View file @
a7a1c425
### PIPELINE DEFINITION
stages
:
-
build
-
test
-
release
variables
:
DOCKER_BUILDKIT
:
1
DOCKER_DRIVER
:
overlay2
DOCKER_HOST
:
tcp://localhost:2375
DOCKER_TLS_CERTDIR
:
"
"
##########################################################################################################
### BUILD SECTION
build
:
stage
:
build
image
:
docker:latest
services
:
-
docker:dind
variables
:
GIT_DEPTH
:
1
DIRECTORY
:
'
.'
before_script
:
-
docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script
:
-
docker build -t "${CI_REGISTRY_IMAGE}:temp-${CI_PIPELINE_IID}" -f "./${DIRECTORY}/Dockerfile" "./${DIRECTORY}"
-
docker push "${CI_REGISTRY_IMAGE}:temp-$CI_PIPELINE_IID"
##########################################################################################################
### TEST SECTION
test
:
stage
:
test
image
:
"
${CI_REGISTRY_IMAGE}:temp-$CI_PIPELINE_IID"
services
:
-
docker:dind
variables
:
GIT_STRATEGY
:
"
none"
GIT_DEPTH
:
0
script
:
-
ansible --version
-
ansible -m ping localhost
##########################################################################################################
### RELEASE SECTION
release
:
stage
:
release
image
:
docker:latest
services
:
-
docker:dind
variables
:
GIT_STRATEGY
:
"
none"
GIT_DEPTH
:
0
only
:
-
/^development$/
-
/^staging$/
-
/^master$/
before_script
:
-
docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script
:
-
export VERSION_OLD=temp-$CI_PIPELINE_IID
-
export VERSION_NEW=$CI_COMMIT_REF_SLUG
-
test $CI_COMMIT_REF_SLUG = "master" && { export VERSION_NEW=latest; }
-
echo "Running [$VERSION_NEW] release from [$VERSION_OLD] build!"
-
docker pull $CI_REGISTRY_IMAGE:$VERSION_OLD && ( docker tag $CI_REGISTRY_IMAGE:$VERSION_OLD $CI_REGISTRY_IMAGE:$VERSION_NEW && docker push $CI_REGISTRY_IMAGE:$VERSION_NEW ) ||
true
This diff is collapsed.
Click to expand it.
Dockerfile
0 → 100644
+
9
−
0
View file @
a7a1c425
FROM
pipelinecomponents/ansible-lint
MAINTAINER
Dmitriy Safronov <zimniy@cyberbrain.pw>
ENV
LANG C.UTF-8
ARG
DEPENDENCIES_RUNTIME="git"
RUN
apk add
--no-cache
$DEPENDENCIES_RUNTIME
WORKDIR
/opt/ansible
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