Open ORESoftware opened 5 years ago
Good idea!
ob thunk
should also get the same feature
Ob thunks always track a branch. We should allow you to not track a branch which would allow not only hashes, but tags as well.
@3noch Yep, makes sense! ob thunk update
and ob deploy update
would need to have a sensible error message when they're not on a branch.
Put differently, this is a bigger feature than just adding a --hash
option. It's a feature of ob thunks themselves.
To make this request more specific - we want an ob deploy init
directory to be able to update to a commit from any branch, not just a commit on a given/fixed branch.
So far we have had trouble getting commits from other branches, and I doubt I am the only one that struggled with the fact that we are limited to commits on the one branch.
This feature will change our lives - we just want to be able to update an ob deploy init folder to accept any hash (from the remote, or any remote, really) not just the tip of a given branch.
You're lives shouldn't be changed too much by this feature because there is an easy workaround you can do until this is implemented. Clone the source repo and inside do git push <remote> <hash>:my-new-deploy-branch
. Then use that branch.
@Ericson2314 thanks I don't completely understand...so you are saying something like this:
ob deploy init foo_folder
cd foo_folder
git clone <src>
git push origin <hash>:branch
can you help me understand exactly? thanks
Hopefully @Ericson2314 can confirm but I think in the scenario you're describing where you're ob deploy init
ing each time you can just switch to the branch you want in the app repo before you run ob deploy init
. (Pulling etc if necessary). This will result in the branch you are on when you run ob deploy init
being the one that's packaged into the src/git.json
in the deploy dir.
If you wanted to update it manually you could check out the source repo in a new place then run ob thunk pack <your_src_dir>~ (eg
ob thunk pack app`) and it would create a git.json that you could copy into the deploy dir.
I described two possibilities -- one is checking out the proper version of the app repo before running ob deploy init
and the other is running ob thunk pack
on the entire source repo, i.e. the app
directory. Your examples above show running ob thunk pack src
in the deploy repo which is not one of those two things.
It turns out I overcomplicated it and you can just do the thunk unpack, then check out the hash you want as a new branch, then push that branch to origin, and then pack it back up, which is what @Ericson2314 was describing.
I deleted some of the noise that I added to the convo since it wasn't useful. To get back to the OP, I assume that this:
ob deploy update --hash X
will be a wrapper around something like this:
cd obdeployinitdir
ob thunk unpack src
cd src
git checkout -b deploythis X # notice
git push -u origin deploythis
cd ..
ob thunk pack src
however one problem that I suspect exists is that we cannot checkout a commit that was not on the original branch? or can we checkout any commit in the original repo?
If we want to update to a specific hash:
is there a way to do that? From what I know,
ob deploy update
always updates to the latest commit for a branch? But we want to update to a specific commit