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

Try to checkout matching gzdev branch for PR jobs #572

Merged
merged 3 commits into from
Dec 1, 2021

Conversation

scpeters
Copy link
Contributor

@scpeters scpeters commented Nov 24, 2021

If a GitHub pull request branch contains matching_branch/, then try to checkout that branch from gzdev. To simplify checking out other branches, clone gzdev without --depth 1.

Part of #564.

Testing:

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 <scpeters@openrobotics.org>
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
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

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

oook!

Suggested change
RUN git -C ${GZDEV_DIR} branch
# print branch for information proposes
RUN git -C ${GZDEV_DIR} branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

jenkins-scripts/docker/lib/docker_generate_dockerfile.bash Outdated Show resolved Hide resolved
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"
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

merged in 2c6faf1

jenkins-scripts/docker/lib/docker_generate_dockerfile.bash Outdated Show resolved Hide resolved
jenkins-scripts/docker/lib/docker_generate_dockerfile.bash Outdated Show resolved Hide resolved
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Copy link
Contributor

@j-rivero j-rivero left a 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 <scpeters@openrobotics.org>
@scpeters scpeters merged commit 56bc22c into master Dec 1, 2021
@scpeters scpeters deleted the scpeters/matching_branch branch December 1, 2021 17:35
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"
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants