Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ci-dockerfiles
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
Service Desk
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
cubicweb
ci-dockerfiles
Commits
0c4149f2ff49
Commit
0c4149f2ff49
authored
3 years ago
by
Simon Chabot
Browse files
Options
Downloads
Patches
Plain Diff
ci: dynamically generates the pipeline
parent
746ab4bdf4c3
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
ci: dynamically generates the pipeline
Pipeline
#87974
passed
3 years ago
Stage: setup
Stage: triggers
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+16
-41
16 additions, 41 deletions
.gitlab-ci.yml
generate_gitlabci.py
+2
-8
2 additions, 8 deletions
generate_gitlabci.py
with
18 additions
and
49 deletions
.gitlab-ci.yml
+
16
−
41
View file @
0c4149f2
stages
:
-
setup
-
triggers
...
@@ -1,17 +4,5 @@
...
@@ -1,17 +4,5 @@
build_buster-slim-pg11
:
generate-config
:
image
:
stage
:
setup
name
:
gcr.io/kaniko-project/executor:debug
image
:
python
entrypoint
:
[
"
"
]
script
:
-
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
-
/kaniko/executor
--context $CI_PROJECT_DIR/library/buster-slim-pg11
--dockerfile $CI_PROJECT_DIR/library/buster-slim-pg11/Dockerfile
--destination $CI_REGISTRY_IMAGE/buster-slim-pg11
build_kubectl-kustomize
:
image
:
name
:
gcr.io/kaniko-project/executor:debug
entrypoint
:
[
"
"
]
script
:
script
:
...
@@ -17,7 +8,6 @@
...
@@ -17,7 +8,6 @@
script
:
script
:
-
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
-
python3 ./generate_gitlabci.py
-
/kaniko/executor
artifacts
:
--context $CI_PROJECT_DIR/library/kubectl-kustomize
paths
:
--dockerfile $CI_PROJECT_DIR/library/kubectl-kustomize/Dockerfile
-
gitlab-ci-generated.yml
--destination $CI_REGISTRY_IMAGE/kubectl-kustomize
...
@@ -23,22 +13,7 @@
...
@@ -23,22 +13,7 @@
build_kubectl
:
trigger-build
:
image
:
stage
:
triggers
name
:
gcr.io/kaniko-project/executor:debug
trigger
:
entrypoint
:
[
"
"
]
include
:
script
:
-
artifact
:
gitlab-ci-generated.yml
-
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
job
:
generate-config
-
/kaniko/executor
--context $CI_PROJECT_DIR/library/kubectl
--dockerfile $CI_PROJECT_DIR/library/kubectl/Dockerfile
--destination $CI_REGISTRY_IMAGE/kubectl
build_python-logilab
:
image
:
name
:
gcr.io/kaniko-project/executor:debug
entrypoint
:
[
"
"
]
script
:
-
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
-
/kaniko/executor
--context $CI_PROJECT_DIR/library/python-logilab
--dockerfile $CI_PROJECT_DIR/library/python-logilab/Dockerfile
--destination $CI_REGISTRY_IMAGE/python-logilab
This diff is collapsed.
Click to expand it.
generate_gitlabci.py
+
2
−
8
View file @
0c4149f2
import
os
import
glob
import
glob
import
sys
import
sys
...
@@ -14,16 +15,10 @@
...
@@ -14,16 +15,10 @@
--destination $CI_REGISTRY_IMAGE/{project}
--destination $CI_REGISTRY_IMAGE/{project}
'''
'''
try
:
with
open
(
'
gitlab-ci-generated.yml
'
,
'
w
'
)
as
f
:
if
sys
.
argv
[
1
]:
TEMPLATE
+=
f
"
--build-arg
{
sys
.
argv
[
1
]
}
=
{
sys
.
argv
[
2
]
}
"
except
IndexError
:
pass
with
open
(
'
.gitlab-ci.yml
'
,
'
w
'
)
as
f
:
for
filepath
in
sorted
(
glob
.
glob
(
'
library/**/Dockerfile
'
,
recursive
=
True
)):
for
filepath
in
sorted
(
glob
.
glob
(
'
library/**/Dockerfile
'
,
recursive
=
True
)):
project
=
'
-
'
.
join
(
filepath
.
split
(
'
/
'
)[
1
:
-
1
])
project
=
'
-
'
.
join
(
filepath
.
split
(
'
/
'
)[
1
:
-
1
])
context
=
filepath
.
replace
(
'
/Dockerfile
'
,
''
)
context
=
filepath
.
replace
(
'
/Dockerfile
'
,
''
)
f
.
write
(
TEMPLATE
.
format
(
project
=
project
,
f
.
write
(
TEMPLATE
.
format
(
project
=
project
,
context
=
context
,
context
=
context
,
filepath
=
filepath
))
filepath
=
filepath
))
...
@@ -24,7 +19,6 @@
...
@@ -24,7 +19,6 @@
for
filepath
in
sorted
(
glob
.
glob
(
'
library/**/Dockerfile
'
,
recursive
=
True
)):
for
filepath
in
sorted
(
glob
.
glob
(
'
library/**/Dockerfile
'
,
recursive
=
True
)):
project
=
'
-
'
.
join
(
filepath
.
split
(
'
/
'
)[
1
:
-
1
])
project
=
'
-
'
.
join
(
filepath
.
split
(
'
/
'
)[
1
:
-
1
])
context
=
filepath
.
replace
(
'
/Dockerfile
'
,
''
)
context
=
filepath
.
replace
(
'
/Dockerfile
'
,
''
)
f
.
write
(
TEMPLATE
.
format
(
project
=
project
,
f
.
write
(
TEMPLATE
.
format
(
project
=
project
,
context
=
context
,
context
=
context
,
filepath
=
filepath
))
filepath
=
filepath
))
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