Skip to content
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

Check if files generated by dist-gen are generated properly #218

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@

set -e

if [[ -f "./manifest.sh" ]]; then
echo "Files are generated by dist-gen. Check if everything generated by distgen properly."
echo "Generating all files by 'make generate-all' ..."
make generate-all
echo "Generated files are generated."
# common submodule is not updated at all. No argument to git diff is needed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering about this comment - if I understand it correctly then the git diff command would show a diff for the common submodule if it was updated right? We do update the common submodule for PRs made against container-common-scripts that use the Required-by keyword in the commit message. Would this work with them as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. We do not do git pull in a submodule. We don't care about the submodule. This would be another test to test if the submodule is updated or not.
But I have found out the command which can be used for it.

git diff --ignore-submodules=all

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example:

$ git diff --ignore-submodules --exit-code
$ echo $?
0
$ git diff --exit-code
diff --git a/common b/common
index ce7b9d1..77d1ea2 160000
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit ce7b9d1aa48cf65bb8071254e4e5396de410904b
+Subproject commit 77d1ea2246524f5849bc088e58d967739f1cb681
$ echo $?
1
$

if git diff --exit-code; then
echo "Pull request does not contain properly generated files."
echo "Please run these command in order to update pull request:"
echo "'make clean-versions'"
echo "'make generate-all'"
exit 1
fi
else
echo "This container does not use dist-gen. Skipping it."
fi

for dir in ${VERSIONS}; do
[ ! -e "${dir}/.image-id" ] && echo "-> Image for version $dir not built, skipping tests." && continue
pushd "${dir}" > /dev/null
Expand Down