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

Update README and fix pipeline template destination #24

Merged
merged 4 commits into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,15 @@ contra-env-setup/playbooks/group_vars/all/global.yml
1. Install on a local server as user cloud-user.
2. Setup pre-reqs (kvm driver and nested virtualization)
3. Setup a minishift cluster
4. Setup OpenShift s2i templates from the project_repo=https://github.com/arilivigni/ci-pipeline
1. Override the project_repo with another one then the default in global.yml
4. Setup OpenShift s2i templates from the -e project_repo=https://github.com/arilivigni/ci-pipeline
1. Override the project_repo with another one then the default in global.yml
2. OpenShift project -e openshift_project=ari-ci-pipeline
5. Modify my container tags with the default tag. tag=stable

```
ansible-playbook -vv -i "localhost," contra-env-setup/playbooks/setup.yml \
-e remote_user=cloud-user -e project_repo=https://github.com/arilivigni/ci-pipeline -K -k
-e remote_user=cloud-user -e project_repo=https://github.com/arilivigni/ci-pipeline
-e openshift_project=ari-ci-pipeline -K -k

```
_Note: The -K is used to prompt you for your password for sudo (if you require one) <br>
Expand All @@ -133,15 +135,16 @@ _Note: The -K is used to prompt you for your password for sudo (if you require o
1. Install on a local server as user cloud-user.
2. Setup pre-reqs (kvm driver and nested virtualization)
3. Setup a minishift cluster
4. Setup OpenShift s2i templates from the project_repo=https://github.com/arilivigni/ci-pipeline
1. Override the project_repo with another one then the default in global.yml
4. Setup OpenShift s2i templates from the -e project_repo=https://github.com/arilivigni/ci-pipeline
1. Override the project_repo with another one then the default in global.yml
2. OpenShift project -e openshift_project=ari-ci-pipeline
5. Modify my container tags with the default tag. tag=stable
6. Setup Jenkins 2.0 pipelines from the project_repo=https://github.com/arilivigni/ci-pipeline

```
ansible-playbook -vv -i "localhost," contra-env-setup/playbooks/setup.yml \
-e remote_user=cloud-user -e project_repo=https://github.com/arilivigni/ci-pipeline \
-e setup_pipelines=true -K -k
-e openshift_project=ari-ci-pipeline -e setup_pipelines=true -K -k

```
_Note: The -K is used to prompt you for your password for sudo (if you require one) <br>
Expand All @@ -153,8 +156,9 @@ _Note: The -K is used to prompt you for your password for sudo (if you require o
1. Install on a local server as user cloud-user.
2. Setup pre-reqs (kvm driver and nested virtualization)
3. Setup a minishift cluster
4. Setup OpenShift s2i templates from the project_repo=https://github.com/arilivigni/ci-pipeline
1. Override the project_repo with another one then the default in global.yml
4. Setup OpenShift s2i templates from the -e project_repo=https://github.com/arilivigni/ci-pipeline
1. Override the project_repo with another one then the default in global.yml
2. OpenShift project -e openshift_project=ari-ci-pipeline
5. Modify my container tags with the tag=develop
6. Setup Jenkins 2.0 pipelines from the project_repo=https://github.com/arilivigni/ci-pipeline
7. Setup sample project templates and pipelines
Expand All @@ -164,7 +168,8 @@ _Note: The -K is used to prompt you for your password for sudo (if you require o
```
ansible-playbook -vv -i "localhost," contra-env-setup/playbooks/setup.yml \
-e remote_user=cloud-user -e project_repo=https://github.com/arilivigni/ci-pipeline \
-e tag=develop -e setup_pipelines=true -e setup_sample_project -K -k
-e openshift_project=ari-ci-pipeline -e tag=develop -e setup_pipelines=true \
-e setup_sample_project -K -k

```
_Note: The -K is used to prompt you for your password for sudo (if you require one) <br>
Expand Down
4 changes: 1 addition & 3 deletions playbooks/group_vars/all/global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ os_template_dir: "config/s2i"

# Jenkins pipelines directory
pipeline_dir: "config/pipelines"
pipeline_dir_orig: "{{ pipeline_dir }}"

# These are parameters that are passed to setup the containers from the project_repo
PARAMS:
Expand Down Expand Up @@ -117,12 +116,11 @@ sample_project_refspec: '+refs/pull/*:refs/heads/*'
sample_project_branch: 'master'

# Sample project directory
sample_project_dir: "{{ contra_env_setup_dir }}/{{ sample_project_repo.split('/')[-1] | replace('.git', '')}}"
sample_project_dir: "{{ contra_env_setup_dir }}/{{ sample_project_repo.split('/')[-1] | replace('.git', '') }}"

# Sample OpenSift template directory
sample_os_template_dir: "config/s2i"

# Sample Jenkins pipelines directory
sample_pipeline_dir: "config/pipelines"
sample_pipeline_dir_orig: "{{ sample_pipeline_dir }}"

18 changes: 0 additions & 18 deletions playbooks/roles/create/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,6 @@
- "{{ minishift_dest_dir }}"
- "{{ loaded_pipelines_dir }}"

- name: "Update os_template_dir based on repo"
set_fact:
os_template_dir: "{{ project_dir }}/{{ os_template_dir }}"

- name: "Update pipeline_dir based on repo"
set_fact:
pipeline_dir: "{{ project_dir }}/{{ pipeline_dir }}"

- name: "Update sample_os_template_dir based on repo"
set_fact:
sample_os_template_dir: "{{ sample_project_dir }}/{{ sample_os_template_dir }}"
when: (project_repo != sample_project_repo and setup_sample_project|bool == true)

- name: "Update sample_pipeline_dir based on repo"
set_fact:
sample_pipeline_dir: "{{ sample_project_dir }}/{{ sample_pipeline_dir }}"
when: (project_repo != sample_project_repo and setup_sample_project|bool == true)

# Clone the project_repo and sample_project_repo
- name: "Clone the project repo {{ project_repo }}"
import_tasks: clone_repos.yml
6 changes: 3 additions & 3 deletions playbooks/roles/os_temps/tasks/setup_containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
# Use the repo's OpenShift s2i templates as the list to process
- name: "Get OpenShift s2i template names from {{ os_template_dir }}"
find:
paths: "{{ os_template_dir }}"
paths: "{{ project_dir }}/{{ os_template_dir }}"
patterns: '*.yml,*.yaml'
recurse: yes
register: os_templates

- name: "Get sample OpenShift s2i template names from {{ sample_os_template_dir }}/samples"
find:
paths: "{{ sample_os_template_dir }}/samples"
paths: "{{ sample_project_dir }}/{{ sample_os_template_dir }}/samples"
patterns: '*.yml,*.yaml'
recurse: yes
register: sample_os_templates
Expand All @@ -29,7 +29,7 @@

- name: "Get sample jenkins OpenShift s2i template names from {{ sample_os_template_dir }}/jenkins"
find:
paths: "{{ sample_os_template_dir }}/jenkins"
paths: "{{ sample_project_dir }}/{{ sample_os_template_dir }}/jenkins"
patterns: '*.yml,*.yaml'
recurse: yes
register: sample_jenkins_os_templates
Expand Down
4 changes: 2 additions & 2 deletions playbooks/roles/pipeline/tasks/setup_pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
- name: "Generate Jenkins XML config for pipeline jobs from the templates"
template:
src: "{{ playbook_dir }}/roles/pipeline/templates/jenkins-pipeline-setup.xml.j2"
dest: "{{ pipeline_dir_orig }}/{{ item.path.split('/')[-2] }}/config.xml"
dest: "{{ loaded_pipelines_dir }}/{{ item.path.split('/')[-2] }}/config.xml"
force: yes
mode: 0755
with_items: "{{ pipelines.files }}"

- name: "Generate Jenkins XML config for sample pipeline jobs from the templates"
template:
src: "{{ playbook_dir }}/roles/pipeline/templates/contra-sample-pipeline-setup.xml.j2"
dest: "{{ sample_pipeline_dir_orig }}/{{ item.path.split('/')[-2] }}/config.xml"
dest: "{{ loaded_pipelines_dir }}/{{ item.path.split('/')[-2] }}/config.xml"
force: yes
mode: 0755
with_items: "{{ sample_pipelines.files }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<submoduleCfg class="list"/>
<extensions/>
</scm>
<scriptPath>{{ sample_pipeline_dir_orig }}/{{ item.path.split('/')[-2] }}/{{ item.path.split('/')[-1] }}</scriptPath>
<scriptPath>{{ sample_project_repo.split('/')[-1] | replace('.git', '') }}/{{ sample_pipeline_dir }}/{{ item.path.split('/')[-1] }}</scriptPath>
<lightweight>true</lightweight>
</definition>
<triggers/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<submoduleCfg class="list"/>
<extensions/>
</scm>
<scriptPath>{{ pipeline_dir_orig }}/{{ item.path.split('/')[-2] }}/{{ item.path.split('/')[-1] }}</scriptPath>
<scriptPath>{{ project_repo.split('/')[-1] | replace('.git', '') }}/{{ pipeline_dir }}/{{ item.path.split('/')[-1] }}</scriptPath>
<lightweight>true</lightweight>
</definition>
<triggers/>
Expand Down