-
Notifications
You must be signed in to change notification settings - Fork 9
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
Try to checkout matching gzdev branch for PR jobs #572
Conversation
If GitHub branch contains `matching_branch/`, then try to checkout that branch from gzdev. Clone without --depth 1 to support this. Signed-off-by: Steve Peters <[email protected]>
RUN git clone https://github.com/ignition-tooling/gzdev -b ${GZDEV_BRANCH} ${GZDEV_DIR} | ||
RUN bash -c "if [[ -n \"$GZDEV_TRY_BRANCH\" ]]; then git -C ${GZDEV_DIR} fetch origin \"$GZDEV_TRY_BRANCH\"; fi || true" | ||
RUN bash -c "if [[ -n \"$GZDEV_TRY_BRANCH\" ]]; then git -C ${GZDEV_DIR} checkout \"$GZDEV_TRY_BRANCH\"; fi || true" | ||
RUN git -C ${GZDEV_DIR} branch |
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.
What are we trying with running git branch here?
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 is just a debugging print statement
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.
oook!
RUN git -C ${GZDEV_DIR} branch | |
# print branch for information proposes | |
RUN git -C ${GZDEV_DIR} branch |
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.
RUN git clone --depth 1 https://github.com/ignition-tooling/gzdev -b ${GZDEV_BRANCH} ${GZDEV_DIR} | ||
RUN git clone https://github.com/ignition-tooling/gzdev -b ${GZDEV_BRANCH} ${GZDEV_DIR} | ||
RUN bash -c "if [[ -n \"$GZDEV_TRY_BRANCH\" ]]; then git -C ${GZDEV_DIR} fetch origin \"$GZDEV_TRY_BRANCH\"; fi || true" | ||
RUN bash -c "if [[ -n \"$GZDEV_TRY_BRANCH\" ]]; then git -C ${GZDEV_DIR} checkout \"$GZDEV_TRY_BRANCH\"; fi || true" |
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.
Could we merge this git command with the previous to save the duplication of the if?
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.
merged in 2c6faf1
Signed-off-by: Steve Peters <[email protected]>
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.
Minor suggestion for a comment but the final result is great. Thanks Steve!
Signed-off-by: Steve Peters <[email protected]>
RUN if [ -n $GZDEV_TRY_BRANCH ]; then \ | ||
git -C ${GZDEV_DIR} fetch origin $GZDEV_TRY_BRANCH || true; \ | ||
git -C ${GZDEV_DIR} checkout $GZDEV_TRY_BRANCH || true; \ | ||
fi || true" |
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.
The stray quote here was removed via direct push 99524e1
If a GitHub pull request branch contains
matching_branch/
, then try to checkout that branch fromgzdev
. To simplify checking out other branches, clone gzdev without--depth 1
.Part of #564.
Testing: