-
-
Notifications
You must be signed in to change notification settings - Fork 745
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
Fix branch checkout logic #2601
Conversation
/cc @armab |
9221287
to
faa8682
Compare
Yeah, if we want to go to a different branch in a shallow clone (--depth 1) we need to use the same "hack" as we use in st2contrib. |
git checkout ${CIRCLE_BRANCH} || true | ||
- .circle/buildenv.sh | ||
- git clone -b ${CIRCLE_BRANCH} --single-branch --depth 1 ${ST2_PACKAGES_REPO} /home/ubuntu/st2/st2-packages | ||
- /home/ubuntu/st2/st2-packages/.circle/buildenv.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.
- .circle/buildenv.sh
for consistency (see commands after this line).
Eg. this change is not needed, since it's current working dir.
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.
Are you sure? Without the cd
the current working dir is not changed.
The entire CWD is non-obvious in cicle ci.
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.
Yes, sure.
The build dir is defined here:
...
general:
build_dir: st2-packages
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.
Thanks!
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.
Also FYI every command in Circle is run in separate subshell, so any vars or cd
are not preserved across different commands, see: https://circleci.com/docs/configuration#phases
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.
That explains a bunch of behavior I am seeing.
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 entire CWD is non-obvious in cicle ci.
That's only start 😆
As said you before, it's not like Travis.
--depth 1
means no branch info therefore the checkout will fail.