-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More logical buildsystem #19
Conversation
All in all I really like the changes from the point of how everything is handled by make dependencies and I was considering to try writing something similar as this myself but unfortunately I am not a great make-magician as of yet. As for the qualms I have about this: |
One additional thing - using image's ID as the content of the IMAGE_NAME variable used inside tests might break said tests for some images that rely on it being a name string that can be parsed properly (I have implemented something like this in thermostat16* tests - sclorg/thermostat-container@a2c6dc3#diff-8c6c67279d694dec8dcd75f8e276c4d9R34) |
Also it is not possible for s2i based images. |
The permissions/ownership of the /dev/pts/* file (symlinked from /dev/fd/$fd) is uncertain, so we can not rely on the fact that we can write to this file (happened to me when I ssh as 'root' to my RHEL7 testing box and then I 'sudo su - foo'). Since we already depend on Bash features extensively, let's rather let the shell allocate a temporary fifo file with >(cmd) feature. While we are on it, separate the parsing method into self-standing method which can be easily reused, and allow parsing also standard error output (will be needed at least in sclorg#19).
The permissions/ownership of the /dev/pts/* file (symlinked from /dev/fd/$fd) is uncertain, so we can not rely on the fact that we can write to this file (happened to me when I ssh as 'root' to my RHEL7 testing box and then I 'sudo su - foo'). Since we already depend on Bash features extensively, let's rather let the shell allocate a temporary fifo file with >(cmd) feature and redirect to a shell file descriptor number by 'cat - >&$fd'. While we are on it, separate the parsing method into self-standing method which can be easily reused, and allow parsing also standard error output (will be needed at least in #19). Fixes #21.
7355830
to
0ce4a5c
Compare
Thanks a lot for the comments. So I changed the semantics a bit to take your notes into account. Now, when doing IMO this is still beneficial:
|
9c76d50
to
5aca0b5
Compare
{ | ||
local base squashed_from squashed= unsquashed=$IMAGE_ID | ||
test "$SKIP_SQUASH" = 1 && return 0 | ||
|
||
# FIXME: We have to use the exact versions here to avoid Docker client | ||
# compatibility issues | ||
local squash_version=1.0.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@praiskup I vote for not checking for exact docker_squash
version.
Imagine a situation when we decides to change this version. We/user will have to update docker_squash
on testing machine to make similar PR tests to pass.
But since other images won't use newest version of container-common-scripts its PRs will fail.
So common-scripts in images will have to updated all in once and all other PRs will fail till that time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@omron93 wrote:
I vote for not checking for exact docker_squash version.
+1. I was not brave enough to drop that ... since this hack was important enough to be fixed many, many times ... So the question is whether we really care about the version or not. Maybe there should be version >= 1.0.5
, but IMO this deserves separate PR and discussion.
Imagine a situation when we decides to change this version. We/user will have to update docker_squash on testing machine to make similar PR tests to pass.
Right, but IMO it is not that huge issue, since we maintain the CI. I don't think user will be somewhat bothered by this.
But since other images won't use newest version of container-common-scripts its PRs will fail.
Agreed. IMO in such case it would be the right time to update common
in the remote repos; and yes -> I don't claim that such hacks are not expensive.
So, since the version check was already merged and is not the part of this PR, what about to remove that later (and let others ack this?)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, since the version check was already merged and is not the part of this PR, what about to remove that later (and let others ack this?)?
You are right
@praiskup Or if you would like to avoid this, some "random" image name can be generated for tests only and removed after. Overall, it looks very good. Thanks. |
Can be, but it brings some complexity -- and I'm not good enough with s2i testing, so I would rather delay this for after-PR time :) if any. Even as-is, the PR somewhat improves the resource management (major motivation for this PR) so I'm less motivated to solve more problems now. |
common.mk
Outdated
VERSIONS="$(VERSIONS)" $(script_env) $(test) | ||
VERSIONS="$(VERSIONS)" $(script_env) $(tag) | ||
|
||
.PHONY: test-openshift | ||
test-openshift: script_env += TEST_OPENSHIFT_MODE=true | ||
test-openshift: $(VERSIONS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo test-openshift
should depend on tag
as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, good catch
otherwise lgtm |
From now we don't blindly squash image if there are no changes (aka docker build was no-op). We also remove old (unreferenced images if those are to be replaced by new images. `make` or `make build` Builds the images. `make tag` Tag built images (depends on `make build`). `make test` Tests the :latest image (build if necessary). This depends on `make tag` because the existing test-cases out in the wild depend on tagged images. The most importantly the s2i tool doesn't seem to work with $IMAGE_ID only.
This helps on builders where umask is e.g. 0077.
It is much more standard to use 'make check' than 'make test'; but let's keep them both (aliases) for compatibility.
5aca0b5
to
cf4053a
Compare
Fixed the |
Use more standardized "make" workflow
From now we don't blindly squash image if there are no changes
(aka docker build was no-op). We also remove old (unreferenced
images if those are to be replaced by new images.
The
make tag
also tags the image with:squashed
or:raw
suffixes,while the
:latest
image points (only) to one of them.