Skip to content

Commit 9255c3b

Browse files
committed
Modify dep-graph to handle circular dependencies and add tests.
1 parent 234a9e4 commit 9255c3b

File tree

15 files changed

+543
-1
lines changed

15 files changed

+543
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## depgraph_namespace
2+
3+
<mission statement goes here>
4+
5+
Maintainer: Your Name <your@mail.org>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ${IMAGE_PARENT}
2+
LABEL maintainer ${MAINTAINER}
3+
4+
ADD rootfs.tar /
5+
6+
#COPY docker-healthcheck.sh /usr/bin/docker-healthcheck
7+
#HEALTHCHECK --interval=60s --timeout=5s --start-period=5s --retries=3 CMD ["docker-healthcheck"]
8+
9+
#CMD ["/bin/some-cmd", "--some-option", "some-value"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## depgraph_namespace/a
2+
3+
Run this [a][] image with:
4+
5+
$ docker run -d --name a depgraph_namespace/a
6+
7+
[Last Build][packages]
8+
9+
[a]: https://a.url
10+
[packages]: PACKAGES.md
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Used build container, optional, default: committed builder of parent image or value of DEFAULT_BUILDER in kubler.conf
2+
#BUILDER="kubler/bob"
3+
4+
# Run build container with `--cap-add SYS_PTRACE`, optional, default: false
5+
#BUILDER_CAPS_SYS_PTRACE='true'
6+
7+
# Mount a host directory in the build container during the build, uses standard Docker -v syntax, default: unset/none
8+
# !! There is a reason Docker does not allow this, consider the consequences regarding build repeatability !!
9+
#BUILDER_MOUNTS=("${KUBLER_DATA_DIR}/tmp/somepath:/path/in/builder:ro")
10+
# Use BUILDER_MOUNTS from parent image(s)?, default: false
11+
#PARENT_BUILDER_MOUNTS='true'
12+
13+
# Any additional docker run args that should be used during the build, optional, default: unset/none
14+
#BUILDER_DOCKER_ARGS=('--cap-add' 'FOO')
15+
16+
# Fully qualified image id (i.e. kubler/busybox), optional, default: scratch
17+
IMAGE_PARENT="depgraph_circular/c"
18+
19+
# Run a standard Docker health-check test as part of the build process. Add the health check as usual in
20+
# Dockerfile.template and set this to true. Official docs: https://docs.docker.com/engine/reference/builder/#healthcheck
21+
#POST_BUILD_HC=true
22+
# The health-check will only pass if the container reported healthy for this many tries
23+
#POST_BUILD_HC_MIN_HEALTHY_STREAK=5
24+
# Timeout for the complete health-check test before it is aborted with an error, START_PERIOD will not count to this limit
25+
#POST_BUILD_HC_MAX_DURATION=30
26+
#
27+
# Any health-check args in the Dockerfile are overridden with the corresponding values below for the duration of
28+
# the test. If not defined the Kubler internal defaults, as seen below, are used.
29+
#
30+
# Run the health-check command every n sec
31+
#POST_BUILD_HC_INTERVAL=5
32+
# Timeout for each health check in secs
33+
#POST_BUILD_HC_TIMEOUT=5
34+
# Grace period in secs for the container to get ready before any checks are run
35+
#POST_BUILD_HC_START_PERIOD=3
36+
# Amount of health-check fails for a container before it considers itself unhealthy
37+
#POST_BUILD_HC_RETRY=3
38+
39+
# Variables starting with BOB_ can be used for parameterization of Dockerfile.template and are also exported to
40+
# the build container, i.e. they may be referenced in your build.sh
41+
#BOB_FOO=bar
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#
2+
# Kubler phase 1 config, pick installed packages and/or customize the build
3+
#
4+
5+
# The recommended way to install software is setting ${_packages}
6+
# List of Gentoo package atoms to be installed at custom root fs ${_EMERGE_ROOT}, optional, space separated
7+
# If you are not sure about package names you may want to start an interactive build container:
8+
# kubler.sh build -i depgraph_namespace/a
9+
# ..and then search the Portage database:
10+
# eix <search-string>
11+
_packages=""
12+
# Install a standard system directory layout at ${_EMERGE_ROOT}, optional, default: false
13+
#BOB_INSTALL_BASELAYOUT=true
14+
15+
# Define custom variables to your liking
16+
#_a_version=1.0
17+
18+
#
19+
# This hook can be used to configure the build container itself, install packages, run any command, etc
20+
#
21+
configure_builder()
22+
{
23+
# Packages installed in this hook don't end up in the final image but are available for depending image builds
24+
#emerge dev-lang/go app-misc/foo
25+
:
26+
}
27+
28+
#
29+
# This hook is called just before starting the build of the root fs
30+
#
31+
configure_rootfs_build()
32+
{
33+
# Update a Gentoo package use flag..
34+
#update_use 'dev-libs/some-lib' '+feature' '-some_other_feature'
35+
36+
# ..or a Gentoo package keyword
37+
#update_keywords 'dev-lang/some-package' '+~amd64'
38+
39+
# Add a package to Portage's package.provided file, effectively skipping it during installation
40+
#provide_package 'dev-lang/some-package'
41+
42+
# This can be useful to install a package from a parent image again, it may be needed at build time
43+
#unprovide_package 'dev-lang/some-package'
44+
45+
# Only needed when ${_packages} is empty, initializes PACKAGES.md
46+
#init_docs "depgraph_namespace/a"
47+
:
48+
}
49+
50+
#
51+
# This hook is called just before packaging the root fs tar ball, ideal for any post-install tasks, clean up, etc
52+
#
53+
finish_rootfs_build()
54+
{
55+
# Useful helpers
56+
57+
# Thin wrapper for sed that fails the build if no match was found, default sed delimiter is %
58+
#sed-or-die '^foo' 'replaceval' "${_EMERGE_ROOT}"/etc/foo.conf
59+
60+
# Download file at url to /distfiles if it doesn't exist yet, file name is derived from last url fragment
61+
#download_file "$url"
62+
#echo "${__download_file}"
63+
# Same as above but set a custom file name
64+
#download_file "$url" my_file_v1.tar.gz
65+
# Same as above but pass arbitrary additional args to curl
66+
#download_file "$url" my_file_v1.tar.gz '-v' '--cookie' 'foo'
67+
68+
# install su-exec at ${_EMERGE_ROOT}
69+
#install_suexec
70+
# Copy c++ libs, may be needed if you see errors regarding missing libstdc++
71+
#copy_gcc_libs
72+
73+
# Example for a manual build if _packages method does not suffice, a typical use case is a Go project:
74+
75+
#export GOPATH="/go"
76+
#export PATH="${PATH}:/go/bin"
77+
#export DISTRIBUTION_DIR="${GOPATH}/src/github.com/depgraph_namespace/a"
78+
#mkdir -p "${DISTRIBUTION_DIR}"
79+
80+
#git clone https://github.com/depgraph_namespace/a.git "${DISTRIBUTION_DIR}"
81+
#cd "${DISTRIBUTION_DIR}"
82+
#git checkout tags/v${_a_version}
83+
#echo "building a ${_a_version}.."
84+
#go run build.go build
85+
#mkdir -p "${_EMERGE_ROOT}"/usr/local/{bin,share}
86+
87+
# Everything at ${_EMERGE_ROOT} will end up in the final image
88+
#cp -rp "${DISTRIBUTION_DIR}/bin/*" "${_EMERGE_ROOT}/usr/local/bin"
89+
90+
# After installing packages manually you might want to add an entry to PACKAGES.md
91+
#log_as_installed "manual install" "a-${_a_version}" "https://a.org/"
92+
93+
# To uninstall software packages in the builder unset ROOT env first
94+
#unset ROOT
95+
#emerge -C foo/bar
96+
:
97+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ${IMAGE_PARENT}
2+
LABEL maintainer ${MAINTAINER}
3+
4+
ADD rootfs.tar /
5+
6+
#COPY docker-healthcheck.sh /usr/bin/docker-healthcheck
7+
#HEALTHCHECK --interval=60s --timeout=5s --start-period=5s --retries=3 CMD ["docker-healthcheck"]
8+
9+
#CMD ["/bin/some-cmd", "--some-option", "some-value"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## depgraph_namespace/b
2+
3+
Run this [b][] image with:
4+
5+
$ docker run -d --name b depgraph_namespace/b
6+
7+
[Last Build][packages]
8+
9+
[b]: https://b.url
10+
[packages]: PACKAGES.md
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Used build container, optional, default: committed builder of parent image or value of DEFAULT_BUILDER in kubler.conf
2+
#BUILDER="kubler/bob"
3+
4+
# Run build container with `--cap-add SYS_PTRACE`, optional, default: false
5+
#BUILDER_CAPS_SYS_PTRACE='true'
6+
7+
# Mount a host directory in the build container during the build, uses standard Docker -v syntax, default: unset/none
8+
# !! There is a reason Docker does not allow this, consider the consequences regarding build repeatability !!
9+
#BUILDER_MOUNTS=("${KUBLER_DATA_DIR}/tmp/somepath:/path/in/builder:ro")
10+
# Use BUILDER_MOUNTS from parent image(s)?, default: false
11+
#PARENT_BUILDER_MOUNTS='true'
12+
13+
# Any additional docker run args that should be used during the build, optional, default: unset/none
14+
#BUILDER_DOCKER_ARGS=('--cap-add' 'FOO')
15+
16+
# Fully qualified image id (i.e. kubler/busybox), optional, default: scratch
17+
IMAGE_PARENT="depgraph_circular/a"
18+
19+
# Run a standard Docker health-check test as part of the build process. Add the health check as usual in
20+
# Dockerfile.template and set this to true. Official docs: https://docs.docker.com/engine/reference/builder/#healthcheck
21+
#POST_BUILD_HC=true
22+
# The health-check will only pass if the container reported healthy for this many tries
23+
#POST_BUILD_HC_MIN_HEALTHY_STREAK=5
24+
# Timeout for the complete health-check test before it is aborted with an error, START_PERIOD will not count to this limit
25+
#POST_BUILD_HC_MAX_DURATION=30
26+
#
27+
# Any health-check args in the Dockerfile are overridden with the corresponding values below for the duration of
28+
# the test. If not defined the Kubler internal defaults, as seen below, are used.
29+
#
30+
# Run the health-check command every n sec
31+
#POST_BUILD_HC_INTERVAL=5
32+
# Timeout for each health check in secs
33+
#POST_BUILD_HC_TIMEOUT=5
34+
# Grace period in secs for the container to get ready before any checks are run
35+
#POST_BUILD_HC_START_PERIOD=3
36+
# Amount of health-check fails for a container before it considers itself unhealthy
37+
#POST_BUILD_HC_RETRY=3
38+
39+
# Variables starting with BOB_ can be used for parameterization of Dockerfile.template and are also exported to
40+
# the build container, i.e. they may be referenced in your build.sh
41+
#BOB_FOO=bar
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#
2+
# Kubler phase 1 config, pick installed packages and/or customize the build
3+
#
4+
5+
# The recommended way to install software is setting ${_packages}
6+
# List of Gentoo package atoms to be installed at custom root fs ${_EMERGE_ROOT}, optional, space separated
7+
# If you are not sure about package names you may want to start an interactive build container:
8+
# kubler.sh build -i depgraph_namespace/b
9+
# ..and then search the Portage database:
10+
# eix <search-string>
11+
_packages=""
12+
# Install a standard system directory layout at ${_EMERGE_ROOT}, optional, default: false
13+
#BOB_INSTALL_BASELAYOUT=true
14+
15+
# Define custom variables to your liking
16+
#_b_version=1.0
17+
18+
#
19+
# This hook can be used to configure the build container itself, install packages, run any command, etc
20+
#
21+
configure_builder()
22+
{
23+
# Packages installed in this hook don't end up in the final image but are available for depending image builds
24+
#emerge dev-lang/go app-misc/foo
25+
:
26+
}
27+
28+
#
29+
# This hook is called just before starting the build of the root fs
30+
#
31+
configure_rootfs_build()
32+
{
33+
# Update a Gentoo package use flag..
34+
#update_use 'dev-libs/some-lib' '+feature' '-some_other_feature'
35+
36+
# ..or a Gentoo package keyword
37+
#update_keywords 'dev-lang/some-package' '+~amd64'
38+
39+
# Add a package to Portage's package.provided file, effectively skipping it during installation
40+
#provide_package 'dev-lang/some-package'
41+
42+
# This can be useful to install a package from a parent image again, it may be needed at build time
43+
#unprovide_package 'dev-lang/some-package'
44+
45+
# Only needed when ${_packages} is empty, initializes PACKAGES.md
46+
#init_docs "depgraph_namespace/b"
47+
:
48+
}
49+
50+
#
51+
# This hook is called just before packaging the root fs tar ball, ideal for any post-install tasks, clean up, etc
52+
#
53+
finish_rootfs_build()
54+
{
55+
# Useful helpers
56+
57+
# Thin wrapper for sed that fails the build if no match was found, default sed delimiter is %
58+
#sed-or-die '^foo' 'replaceval' "${_EMERGE_ROOT}"/etc/foo.conf
59+
60+
# Download file at url to /distfiles if it doesn't exist yet, file name is derived from last url fragment
61+
#download_file "$url"
62+
#echo "${__download_file}"
63+
# Same as above but set a custom file name
64+
#download_file "$url" my_file_v1.tar.gz
65+
# Same as above but pass arbitrary additional args to curl
66+
#download_file "$url" my_file_v1.tar.gz '-v' '--cookie' 'foo'
67+
68+
# install su-exec at ${_EMERGE_ROOT}
69+
#install_suexec
70+
# Copy c++ libs, may be needed if you see errors regarding missing libstdc++
71+
#copy_gcc_libs
72+
73+
# Example for a manual build if _packages method does not suffice, a typical use case is a Go project:
74+
75+
#export GOPATH="/go"
76+
#export PATH="${PATH}:/go/bin"
77+
#export DISTRIBUTION_DIR="${GOPATH}/src/github.com/depgraph_namespace/b"
78+
#mkdir -p "${DISTRIBUTION_DIR}"
79+
80+
#git clone https://github.com/depgraph_namespace/b.git "${DISTRIBUTION_DIR}"
81+
#cd "${DISTRIBUTION_DIR}"
82+
#git checkout tags/v${_b_version}
83+
#echo "building b ${_b_version}.."
84+
#go run build.go build
85+
#mkdir -p "${_EMERGE_ROOT}"/usr/local/{bin,share}
86+
87+
# Everything at ${_EMERGE_ROOT} will end up in the final image
88+
#cp -rp "${DISTRIBUTION_DIR}/bin/*" "${_EMERGE_ROOT}/usr/local/bin"
89+
90+
# After installing packages manually you might want to add an entry to PACKAGES.md
91+
#log_as_installed "manual install" "b-${_b_version}" "https://b.org/"
92+
93+
# To uninstall software packages in the builder unset ROOT env first
94+
#unset ROOT
95+
#emerge -C foo/bar
96+
:
97+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ${IMAGE_PARENT}
2+
LABEL maintainer ${MAINTAINER}
3+
4+
ADD rootfs.tar /
5+
6+
#COPY docker-healthcheck.sh /usr/bin/docker-healthcheck
7+
#HEALTHCHECK --interval=60s --timeout=5s --start-period=5s --retries=3 CMD ["docker-healthcheck"]
8+
9+
#CMD ["/bin/some-cmd", "--some-option", "some-value"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## depgraph_namespace/c
2+
3+
Run this [c][] image with:
4+
5+
$ docker run -d --name c depgraph_namespace/c
6+
7+
[Last Build][packages]
8+
9+
[c]: https://c.url
10+
[packages]: PACKAGES.md
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Used build container, optional, default: committed builder of parent image or value of DEFAULT_BUILDER in kubler.conf
2+
#BUILDER="kubler/bob"
3+
4+
# Run build container with `--cap-add SYS_PTRACE`, optional, default: false
5+
#BUILDER_CAPS_SYS_PTRACE='true'
6+
7+
# Mount a host directory in the build container during the build, uses standard Docker -v syntax, default: unset/none
8+
# !! There is a reason Docker does not allow this, consider the consequences regarding build repeatability !!
9+
#BUILDER_MOUNTS=("${KUBLER_DATA_DIR}/tmp/somepath:/path/in/builder:ro")
10+
# Use BUILDER_MOUNTS from parent image(s)?, default: false
11+
#PARENT_BUILDER_MOUNTS='true'
12+
13+
# Any additional docker run args that should be used during the build, optional, default: unset/none
14+
#BUILDER_DOCKER_ARGS=('--cap-add' 'FOO')
15+
16+
# Fully qualified image id (i.e. kubler/busybox), optional, default: scratch
17+
IMAGE_PARENT="depgraph_circular/b"
18+
19+
# Run a standard Docker health-check test as part of the build process. Add the health check as usual in
20+
# Dockerfile.template and set this to true. Official docs: https://docs.docker.com/engine/reference/builder/#healthcheck
21+
#POST_BUILD_HC=true
22+
# The health-check will only pass if the container reported healthy for this many tries
23+
#POST_BUILD_HC_MIN_HEALTHY_STREAK=5
24+
# Timeout for the complete health-check test before it is aborted with an error, START_PERIOD will not count to this limit
25+
#POST_BUILD_HC_MAX_DURATION=30
26+
#
27+
# Any health-check args in the Dockerfile are overridden with the corresponding values below for the duration of
28+
# the test. If not defined the Kubler internal defaults, as seen below, are used.
29+
#
30+
# Run the health-check command every n sec
31+
#POST_BUILD_HC_INTERVAL=5
32+
# Timeout for each health check in secs
33+
#POST_BUILD_HC_TIMEOUT=5
34+
# Grace period in secs for the container to get ready before any checks are run
35+
#POST_BUILD_HC_START_PERIOD=3
36+
# Amount of health-check fails for a container before it considers itself unhealthy
37+
#POST_BUILD_HC_RETRY=3
38+
39+
# Variables starting with BOB_ can be used for parameterization of Dockerfile.template and are also exported to
40+
# the build container, i.e. they may be referenced in your build.sh
41+
#BOB_FOO=bar

0 commit comments

Comments
 (0)