Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #36 from joubu/issue_9
Browse files Browse the repository at this point in the history
Issue #9 - Add the ability to provide a commit id or a tag name
  • Loading branch information
kylemhall authored May 29, 2020
2 parents 2364301 + 1eed8e3 commit ea64298
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
25 changes: 20 additions & 5 deletions ansible/create-sandbox-instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,34 @@
ansible_connection: docker
changed_when: false

- name: "Add git remote {{ GIT_REMOTE }} as {{ KOHA_INSTANCE }} and checkout {{ GIT_BRANCH }}"
- name: "Add git remote {{ GIT_REMOTE }} as {{ KOHA_INSTANCE }} in docker container"
delegate_to: "koha-{{ KOHA_INSTANCE }}"
shell: "cd /kohadevbox/koha && git remote add {{ KOHA_INSTANCE }} {{ GIT_REMOTE }} && git fetch {{ KOHA_INSTANCE }} && git checkout {{ KOHA_INSTANCE }}/{{ GIT_BRANCH }}"
when: not( (GIT_REMOTE is undefined) or (GIT_REMOTE is none) or (GIT_REMOTE | trim == '')) and not( (GIT_BRANCH is undefined) or (GIT_BRANCH is none) or (GIT_BRANCH | trim == '') )
shell: "cd /kohadevbox/koha && git remote add {{ KOHA_INSTANCE }} {{ GIT_REMOTE }} && git fetch {{ KOHA_INSTANCE }}"
when: not( (GIT_REMOTE is undefined) or (GIT_REMOTE is none) or (GIT_REMOTE | trim == ''))
ignore_errors: yes

- name: "git checkout commit_id or tag {{ GIT_COMMITID }} in docker container"
delegate_to: "koha-{{ KOHA_INSTANCE }}"
shell: "cd /kohadevbox/koha && git checkout {{ GIT_COMMITID }}"
when: not( (GIT_COMMITID is undefined) or (GIT_COMMITID is none) or (GIT_COMMITID | trim == '') )
ignore_errors: yes
notify:
- "Restart plack in docker container"
- "Run updatedatabase.pl in docker container"

- name: "git checkout {{ KOHA_INSTANCE }}/{{ GIT_BRANCH }} in docker container"
delegate_to: "koha-{{ KOHA_INSTANCE }}"
shell: "cd /kohadevbox/koha && git checkout {{KOHA_INSTANCE}}/{{ GIT_BRANCH }}"
when: not( (GIT_BRANCH is undefined) or (GIT_BRANCH is none) or (GIT_BRANCH | trim == '') )
ignore_errors: yes
notify:
- "Restart plack in docker container"
- "Run updatedatabase.pl in docker container"

- name: "Checkout origin/master in docker container"
delegate_to: "koha-{{ KOHA_INSTANCE }}"
shell: "cd /kohadevbox/koha && yes | git checkout origin/master"
when: ((GIT_REMOTE is undefined) or (GIT_REMOTE is none) or (GIT_REMOTE | trim == '')) or ((GIT_BRANCH is undefined) or (GIT_BRANCH is none) or (GIT_BRANCH | trim == ''))
shell: "cd /kohadevbox/koha && git checkout origin/master"
when: ((GIT_REMOTE is undefined) or (GIT_REMOTE is none) or (GIT_REMOTE | trim == '')) and ((GIT_BRANCH is undefined) or (GIT_BRANCH is none) or (GIT_BRANCH | trim == '')) and ((GIT_COMMITID is undefined) or (GIT_COMMITID is none) or (GIT_COMMITID | trim == ''))
ignore_errors: no
notify:
- "Restart plack in docker container"
Expand Down
2 changes: 2 additions & 0 deletions sandbox_manager/lib/SandboxManager/Controller/Sandboxes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ sub create_submit {
my $marc_flavour = $self->param('marc_flavour') || 'marc21';
my $git_remote = $self->param('git_remote');
my $git_branch = $self->param('git_branch');
my $git_commitid = $self->param('git_commitid');

my $errors = {};
$errors->{name_required} = 1 unless $name;
Expand Down Expand Up @@ -100,6 +101,7 @@ sub create_submit {
KOHA_MARC_FLAVOUR => $marc_flavour,
GIT_REMOTE => $git_remote,
GIT_BRANCH => $git_branch,
GIT_COMMITID => $git_commitid,
NOTES => $notes,
DESCRIPTION => $description,
PASSWORD => $password,
Expand Down
3 changes: 3 additions & 0 deletions sandbox_manager/templates/sandboxes/create_form.html.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
<br/>
<input type="text" class="form-control" name="git_branch" id="git_branch" aria-describedby="git_branchHelp" placeholder="Enter name of branch" value="[% params.git_branch | html %]">
<small id="git_remoteHelp" class="form-text text-muted">Enter a Koha git remote address and branch here and it will be applied to your sandbox.</small>
<br/>
<input type="text" class="form-control" name="git_commitid" id="git_commitid" aria-describedby="git_commitidHelp" placeholder="Enter commit id or tag name">
<small id="git_commitidHelp" class="form-text text-muted">Or enter a commit id or a tag name to checkout.</small>
</div>

<div class="form-group">
Expand Down

0 comments on commit ea64298

Please sign in to comment.