Skip to content

Commit

Permalink
git workflow allow to clone a specific branch other than master
Browse files Browse the repository at this point in the history
When specifying commit as a commit sha, then this commit cannot be
fetched, therefore it has to be in the history, which is cloned.
  • Loading branch information
epDHowwD committed Oct 12, 2018
1 parent 17b3bcc commit 0535043
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/job/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ An example git job definition:
|type|true|string||Has to be "git" to include a workflow from a repository|
|name|true|string||Name of the job|
|clone_url|true|string||Url to clone the git repository|
|branch|false|string|master|branch to clone initially
|commit|true|string||branch name or commit sha|
|depends_on|false|[Dependency Configuration](/docs/job/dependencies.md)|[]|Jobs may have dependencies. You can list all jobs which should finish before the current job may be executed.|
|environment|false|[Environment Variables](/docs/job/env_vars.md)|{}|Can be used to set environment variables for the job.|
Expand Down
3 changes: 2 additions & 1 deletion src/job/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,13 +1125,14 @@ def get_job_list(self, data, c, repo, parent_name="",
if job['type'] == "git":
c.header("Clone repo %s" % job['clone_url'], show=True)
clone_url = job['clone_url']
branch = job.get("branch", None)

sub_path = os.path.join('.infrabox', 'tmp', job_name)
new_repo_path = os.path.join(self.mount_repo_dir, sub_path)
c.execute(['rm', '-rf', new_repo_path])
os.makedirs(new_repo_path)

self.clone_repo(job['commit'], clone_url, None, None, True, sub_path)
self.clone_repo(job['commit'], clone_url, branch, None, True, sub_path)

c.header("Parsing infrabox file", show=True)
ib_file = job.get('infrabox_file', None)
Expand Down

0 comments on commit 0535043

Please sign in to comment.