-
Notifications
You must be signed in to change notification settings - Fork 218
More distgen - directory generation #203
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
Conversation
@@ -51,49 +51,49 @@ Environment variables and volumes | |||
The image recognizes the following environment variables that you can set during | |||
initialization by passing `-e VAR=VALUE` to the Docker run command. | |||
|
|||
**`POSTGRESQL_USER`** |
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.
These trailing spaces are actually left there on purpose.
See: #185 (comment)
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.
Not only that, white-space changes just cause rush in pull-requests. Please consider fixing your editor to not remove trailing white-spaces automatically (submit new PR for white-space issues, when needed)
gen-dirs.sh
Outdated
set -e | ||
cd templates | ||
FILES=$(find -follow) | ||
VERSIONS="9.4 9.5 9.6" |
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.
VERSIONS should get passed to the script from the Makefile, so that the list can be maintained in one place.
Since we agreed to remove the generated files in future we should make sure that we do not lose all of the git history by moving latest into template in a separate commit in this PR. |
(not sure if we even need |
To have an idea what I mean by this please check how |
cd87eff
to
117f913
Compare
We might also want to preserve Dockerfile history therefore there are now two more commits to make that happen. |
Makefile
Outdated
@@ -2,6 +2,7 @@ | |||
BASE_IMAGE_NAME = postgresql | |||
VERSIONS = 9.4 9.5 9.6 | |||
OPENSHIFT_NAMESPACES = 9.2 | |||
export 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.
I am a bit scared exporting VERSIONS might break something in the existing scripts. It would be better if you just kept the versions variable local for the gen-dirs.sh
script. So something like:
VERSIONS="$(VERSIONS)" ./gen-dirs.sh
That is true, thanks for picking up on this! |
117f913
to
49aa1dd
Compare
Makefile
Outdated
${DG_EXEC} --distro rhel-7-x86_64.yaml --multispec-selector version=$${version} --output $${version}/Dockerfile.rhel7; \ | ||
done | ||
distgen: | ||
VERSIONS="$(VERSIONS)" ./gen-dirs.sh |
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.
Please use make targets instead of this script, and please develop them in container-common-scripts
project ...
Running this script takes ~12s on my box, because distgen is pretty slow TBH:
$ make distgen
real 0m11.999s
user 0m11.124s
sys 0m0.827s
(at least at this point). make
should help with building it in parallel.
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.
I agree. Adding the rules to container-common-scrtips
will make the distgen change much easier to adopt in other images if the maintainers choose to do so.
gen-dirs.sh
Outdated
/usr/bin/dg --max-passes 25 --template ${PWD}/../Dockerfile.template \ | ||
--multispec ../specs/multispec.yml --distro rhel-7-x86_64.yaml \ | ||
--multispec-selector version=$1 --output ../$1/Dockerfile.rhel7 | ||
|
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.
I'm not sure I follow right, but I think the goal is to remove the generated products from this repo, right?
I would really prefer to not list centos/rhel dockerfiles here, and anywhere else. We'll have fedora dockerfiles soon, and maybe scls+fedora? Who knows.. So it would be nice if, when generating Dockerfile, the $OS variable was respected.
gen-dirs.sh
Outdated
#!/bin/bash | ||
set -e | ||
cd templates | ||
FILES=$(find -follow) |
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.
Hm, I dislike this, tbh. Especially that we filter everything through the build script, while simple copy would often be enough.
Maybe we could separate the real templates into ./templates, and normal files under ./files?
Other approach could be using some "manifest file", I implemented something like this in https://github.com/devexp-db/cont-postgresql/blob/master/cl-manifest
That file declars what should be copied, what should be "instantiated" (and by what tool) and everything explicitly (not copying some accidentally occurred files). This should stay executed by postgresql "in parallel" if implemented.
gen-dirs.sh
Outdated
mkdir ../${version}/$1 | ||
else | ||
echo "Generating: ${version}/$1" | ||
/usr/bin/dg --max-passes 1 --multispec ../specs/multispec.yml \ |
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.
Once this is moved to Makefile (common.mk probably), please ensure that instead of /usr/bin/dg you are using $(DG)
variable; to allow anybody to replace the distgen version from local installation (virtualenv).
49aa1dd
to
ecd0366
Compare
Blocked by sclorg/container-common-scripts#38 |
manifest.sh
Outdated
# Manifest for image directories creation | ||
# every dest and link_name path will be prefixed by $DEST_DIR/$version | ||
|
||
DEST_DIR='' # optional, defaults to $PWD |
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.
s/DEST_DIR/DESTDIR/ -> that's far more standard variable
manifest.sh
Outdated
|
||
src=templates/root/usr/share/container-scripts/postgresql/common.sh | ||
dest=root/usr/share/container-scripts/postgresql/common.sh | ||
mode=0755 |
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.
This doesn't have to be executable.
manifest.sh
Outdated
|
||
link_target=../test | ||
link_name=test | ||
" |
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.
This seems to create absolute symlinks on the host system during build. Such simlinks - if copied into image - will lead to non-existing paths.
manifest.sh
Outdated
|
||
src=templates/root/usr/share/container-scripts/postgresql/scl_enable | ||
dest=root/usr/share/container-scripts/postgresql/scl_enable | ||
mode=0755; |
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.
I don't think this needs to be executable.
For me, I'm leaning towards +1, but not without another positive votes. |
The PR looks good to me. Good job @dhodovsk . WDYT? |
Wow, I'm really impressed how far distgen got. The manifest is some really good work (I would personally prefer json/yaml + python, but if the proposed implementation suits your needs, that's just fine). I also agree with Pavel the time will tell. Hence I'm +1 on merging and addressing issues as they come. |
2352783
to
b50df2c
Compare
The requested changes should be now applied. I'd like to discuss the possibility to drop directories that can be generated. I think we should do it to prevent the case someone commits changes in generated files (and not src). But it seems like a big step and we have to make sure it is safe. |
I am now rebasing and adding following changes:
Is that enough? @TomasTomecek @pkubatrh |
cef8c00
to
8d2bc73
Compare
8d2bc73
to
32925c9
Compare
It should be. I don't know if the cccp.yaml file present in git repo overrides the one defined in cccp index git repo. |
Is there a way to test things out with the current configuration before merging the changes? |
Now that I look at it more closely. Will the prebuild script be even run if the yaml file in the container-index point to versioned directories? If I understand this correctly cccp expects to find the |
hooks/pre_build_centos
Outdated
yum install distgen make -y | ||
|
||
mkdir -p root/ | ||
make VARIANT=centos DISTRO=centos-7-x86_64 source |
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.
Probably needs to be make TARGET=centos7 generate
? We also do not need the root/
directory creation.
Actually according to https://github.com/CentOS/container-index/blob/master/README.md the |
83946f1
to
32925c9
Compare
The commit |
I think we need at least the hook part of the commit (the actual script I commented on), since the versioned directories will still need to be generated. Its just that the configuration option to run it will need to be added elsewhere - similarly to https://github.com/container-images/tools |
I am sorry, but I have no insight in functionality and importance of changes related to cccp, so I am not able to decide the right workflow, could you please provide more info of what changes exactly are needed so the requirements are met? Or maybe provide a commit with those changes? |
I have added a commit with what I believe is needed for the cccp to work once changes are made in https://github.com/CentOS/container-index Now the question is, do we merge this in first and make the changes in index later? The other option is to merge this PR in without the removal of versioned directories so that cccp works both with the old and with new configuration option ( |
I would merge this PR and next fix the index. |
[test-openshift] |
@hhorak would it be OK to have the cccp outage temporarily? |
Since Honza will not be able to comment on this for a while and everyone else is in favour of merging the PR and fixing the issues (and the tests are green) let us merge this in. |
sclorg/postgresql-container#203 Sources needs to be generated before build
In this PR we added ability to generate directories 9.4, 9.5 and 9.6 using distgen.
Directories are generated using ./src directory and with command
make generate