-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
178 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
- name: Deploy packit-service into OpenShift with staging secrets | ||
hosts: localhost | ||
tasks: | ||
- name: Download the deployment | ||
git: | ||
repo: 'https://github.com/packit-service/deployment.git' | ||
dest: /tmp/deployment | ||
clone: yes | ||
- name: Install packages for deployment | ||
dnf: | ||
name: | ||
- ansible-2.7.10-1.fc30 # because of packit-service deployment | ||
- python3-openshift | ||
- make | ||
|
||
- name: get token | ||
command: echo asdasdasdasd | ||
register: kubeconfig_token | ||
|
||
- name: Create dev.yml template | ||
copy: | ||
content: | | ||
# Openshift project/namespace name | ||
project: myproject | ||
# Openshift cluster url (example: https://192.168.42.66:8443) | ||
host: https://127.0.0.1:443 | ||
# oc login <the above host value>, oc whoami -t | ||
# OR via Openshift web GUI: click on your login in top right corner, 'Copy Login Command', take the part after --token= | ||
api_key: {{ kubeconfig_token }} | ||
# To work-around 'SSL: CERTIFICATE_VERIFY_FAILED' | ||
verify_ssl: no | ||
# don't deploy fedmsg dc; good for local testing | ||
without_fedmsg: false | ||
# don't deploy redis-commander dc; good for staging deployment | ||
without_redis_commander: false | ||
# don't deploy flower dc; good for staging deployment | ||
without_flower: false | ||
# you can set the sandbox namespace name explicitly like this | ||
sandbox_namespace: "packit-dev-sandbox" | ||
dest: /tmp/deployment/vars/dev.yml.j2 | ||
- name: Create dev.yaml | ||
template: | ||
src: /tmp/deployment/vars/dev.yml.j2 | ||
dest: /tmp/deployment/vars/dev.yml | ||
|
||
- name: Actually deploy | ||
command: make deploy | ||
environment: | ||
DEPLOYMENT: dev | ||
ANSIBLE_STDOUT_CALLBACK: debug | ||
args: | ||
chdir: /tmp/deployment/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
- name: Install dependencies for packit service. | ||
hosts: all | ||
tasks: | ||
- name: Install basic utilities which should be in environment. | ||
dnf: | ||
name: | ||
- git | ||
- rpmdevtools | ||
- docker | ||
- podman | ||
state: present | ||
become: true | ||
- name: Put SELinux in permissive mode, logging actions that would be blocked. | ||
selinux: | ||
policy: targeted | ||
state: permissive | ||
become: true | ||
- name: Make sure docker is running | ||
systemd: | ||
name: docker | ||
state: started | ||
become: true | ||
- name: Create docker deamon config | ||
file: | ||
path: /etc/docker/daemon.json | ||
state: touch | ||
become: true | ||
- name: Add OpenShift insecure registry into docker deamon config | ||
copy: | ||
content: | | ||
{"insecure-registries" : [ "172.30.0.0/16" ]} | ||
dest: /etc/docker/daemon.json | ||
become: true | ||
- name: Restart docker because config has changed | ||
systemd: | ||
state: restarted | ||
daemon_reload: yes | ||
name: docker | ||
become: true | ||
- name: Install OpenShift server | ||
dnf: | ||
name: | ||
- origin | ||
state: present | ||
become: true | ||
- name: Start Openshift cluster | ||
command: oc cluster up --base-dir=/tmp | ||
environment: | ||
PATH: "{{ ansible_env.PATH }}:/usr/local/bin" | ||
DOCKER_CONFIG: "/etc/docker/daemon.json" | ||
become: true | ||
|
||
- name: Create sandbox project | ||
command: oc new-project packit-dev-sandbox | ||
environment: | ||
PATH: "{{ ansible_env.PATH }}:/usr/local/bin" | ||
become: true |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- name: "Build packit-service image from current src dir" | ||
command: make build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
- set_fact: | ||
project_dir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" | ||
when: zuul is defined | ||
- name: stat {{ project_dir }} | ||
stat: | ||
path: '{{ project_dir }}' | ||
tags: | ||
- no-cache | ||
register: src_path | ||
- name: Let's make sure {{ project_dir }} is present | ||
assert: | ||
that: | ||
- 'src_path.stat.isdir' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
- name: This is a recipe for how to run packit tests | ||
hosts: all | ||
tasks: | ||
- include_tasks: tasks/zuul-project-setup.yaml | ||
- include_tasks: tasks/packit-service-image.yaml | ||
- import_playbook: deploy-service.yaml | ||
- name: Run tests | ||
command: make check_in_container | ||
args: | ||
chdir: '{{ project_dir }}' |