Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
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
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
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
Timo Ley
synapse
Commits
f22252d4
Unverified
Commit
f22252d4
authored
3 years ago
by
Richard van der Hoff
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Enable docker image caching for the deb build (#10431)
parent
ab82fd6e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.github/workflows/release-artifacts.yml
+35
-4
35 additions, 4 deletions
.github/workflows/release-artifacts.yml
changelog.d/10431.misc
+1
-0
1 addition, 0 deletions
changelog.d/10431.misc
scripts-dev/build_debian_packages
+29
-9
29 additions, 9 deletions
scripts-dev/build_debian_packages
with
65 additions
and
13 deletions
.github/workflows/release-artifacts.yml
+
35
−
4
View file @
f22252d4
...
@@ -48,12 +48,43 @@ jobs:
...
@@ -48,12 +48,43 @@ jobs:
distro
:
${{ fromJson(needs.get-distros.outputs.distros) }}
distro
:
${{ fromJson(needs.get-distros.outputs.distros) }}
steps
:
steps
:
-
uses
:
actions/checkout@v2
-
name
:
Checkout
uses
:
actions/checkout@v2
with
:
with
:
path
:
src
path
:
src
-
uses
:
actions/setup-python@v2
-
run
:
./src/scripts-dev/build_debian_packages "${{ matrix.distro }}"
-
name
:
Set up Docker Buildx
-
uses
:
actions/upload-artifact@v2
id
:
buildx
uses
:
docker/setup-buildx-action@v1
with
:
install
:
true
-
name
:
Set up docker layer caching
uses
:
actions/cache@v2
with
:
path
:
/tmp/.buildx-cache
key
:
${{ runner.os }}-buildx-${{ github.sha }}
restore-keys
:
|
${{ runner.os }}-buildx-
-
name
:
Set up python
uses
:
actions/setup-python@v2
-
name
:
Build the packages
# see https://github.com/docker/build-push-action/issues/252
# for the cache magic here
run
:
|
./src/scripts-dev/build_debian_packages \
--docker-build-arg=--cache-from=type=local,src=/tmp/.buildx-cache \
--docker-build-arg=--cache-to=type=local,mode=max,dest=/tmp/.buildx-cache-new \
--docker-build-arg=--progress=plain \
--docker-build-arg=--load \
"${{ matrix.distro }}"
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
-
name
:
Upload debs as artifacts
uses
:
actions/upload-artifact@v2
with
:
with
:
name
:
debs
name
:
debs
path
:
debs/*
path
:
debs/*
...
...
This diff is collapsed.
Click to expand it.
changelog.d/10431.misc
0 → 100644
+
1
−
0
View file @
f22252d4
Use a docker image cache for the prerequisites for the debian package build.
This diff is collapsed.
Click to expand it.
scripts-dev/build_debian_packages
+
29
−
9
View file @
f22252d4
...
@@ -17,6 +17,7 @@ import subprocess
...
@@ -17,6 +17,7 @@ import subprocess
import
sys
import
sys
import
threading
import
threading
from
concurrent.futures
import
ThreadPoolExecutor
from
concurrent.futures
import
ThreadPoolExecutor
from
typing
import
Optional
,
Sequence
DISTS
=
(
DISTS
=
(
"
debian:buster
"
,
"
debian:buster
"
,
...
@@ -39,8 +40,11 @@ projdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
...
@@ -39,8 +40,11 @@ projdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
class
Builder
(
object
):
class
Builder
(
object
):
def
__init__
(
self
,
redirect_stdout
=
False
):
def
__init__
(
self
,
redirect_stdout
=
False
,
docker_build_args
:
Optional
[
Sequence
[
str
]]
=
None
):
self
.
redirect_stdout
=
redirect_stdout
self
.
redirect_stdout
=
redirect_stdout
self
.
_docker_build_args
=
tuple
(
docker_build_args
or
())
self
.
active_containers
=
set
()
self
.
active_containers
=
set
()
self
.
_lock
=
threading
.
Lock
()
self
.
_lock
=
threading
.
Lock
()
self
.
_failed
=
False
self
.
_failed
=
False
...
@@ -79,8 +83,8 @@ class Builder(object):
...
@@ -79,8 +83,8 @@ class Builder(object):
stdout
=
None
stdout
=
None
# first build a docker image for the build environment
# first build a docker image for the build environment
subprocess
.
check_call
(
build_args
=
(
[
(
"
docker
"
,
"
docker
"
,
"
build
"
,
"
build
"
,
"
--tag
"
,
"
--tag
"
,
...
@@ -89,8 +93,13 @@ class Builder(object):
...
@@ -89,8 +93,13 @@ class Builder(object):
"
distro=
"
+
dist
,
"
distro=
"
+
dist
,
"
-f
"
,
"
-f
"
,
"
docker/Dockerfile-dhvirtualenv
"
,
"
docker/Dockerfile-dhvirtualenv
"
,
"
docker
"
,
)
],
+
self
.
_docker_build_args
+
(
"
docker
"
,)
)
subprocess
.
check_call
(
build_args
,
stdout
=
stdout
,
stdout
=
stdout
,
stderr
=
subprocess
.
STDOUT
,
stderr
=
subprocess
.
STDOUT
,
cwd
=
projdir
,
cwd
=
projdir
,
...
@@ -147,9 +156,7 @@ class Builder(object):
...
@@ -147,9 +156,7 @@ class Builder(object):
self
.
active_containers
.
remove
(
c
)
self
.
active_containers
.
remove
(
c
)
def
run_builds
(
dists
,
jobs
=
1
,
skip_tests
=
False
):
def
run_builds
(
builder
,
dists
,
jobs
=
1
,
skip_tests
=
False
):
builder
=
Builder
(
redirect_stdout
=
(
jobs
>
1
))
def
sig
(
signum
,
_frame
):
def
sig
(
signum
,
_frame
):
print
(
"
Caught SIGINT
"
)
print
(
"
Caught SIGINT
"
)
builder
.
kill_containers
()
builder
.
kill_containers
()
...
@@ -180,6 +187,11 @@ if __name__ == "__main__":
...
@@ -180,6 +187,11 @@ if __name__ == "__main__":
action
=
"
store_true
"
,
action
=
"
store_true
"
,
help
=
"
skip running tests after building
"
,
help
=
"
skip running tests after building
"
,
)
)
parser
.
add_argument
(
"
--docker-build-arg
"
,
action
=
"
append
"
,
help
=
"
specify an argument to pass to docker build
"
,
)
parser
.
add_argument
(
parser
.
add_argument
(
"
--show-dists-json
"
,
"
--show-dists-json
"
,
action
=
"
store_true
"
,
action
=
"
store_true
"
,
...
@@ -195,4 +207,12 @@ if __name__ == "__main__":
...
@@ -195,4 +207,12 @@ if __name__ == "__main__":
if
args
.
show_dists_json
:
if
args
.
show_dists_json
:
print
(
json
.
dumps
(
DISTS
))
print
(
json
.
dumps
(
DISTS
))
else
:
else
:
run_builds
(
dists
=
args
.
dist
,
jobs
=
args
.
jobs
,
skip_tests
=
args
.
no_check
)
builder
=
Builder
(
redirect_stdout
=
(
args
.
jobs
>
1
),
docker_build_args
=
args
.
docker_build_arg
)
run_builds
(
builder
,
dists
=
args
.
dist
,
jobs
=
args
.
jobs
,
skip_tests
=
args
.
no_check
,
)
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