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

Fix branch checkout logic #2601

Merged
merged 2 commits into from
Mar 26, 2016
Merged

Fix branch checkout logic #2601

merged 2 commits into from
Mar 26, 2016

Conversation

manasdk
Copy link
Contributor

@manasdk manasdk commented Mar 25, 2016

--depth 1 means no branch info therefore the checkout will fail.

@manasdk
Copy link
Contributor Author

manasdk commented Mar 25, 2016

/cc @armab

@Kami
Copy link
Member

Kami commented Mar 25, 2016

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
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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

See: https://circleci.com/docs/configuration#build-dir

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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.

@manasdk manasdk merged commit d9180d5 into v1.3.3 Mar 26, 2016
@manasdk manasdk deleted the v1.3.3_fix_checkout_logic branch March 26, 2016 02:47
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