-
Notifications
You must be signed in to change notification settings - Fork 3
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
create a new deploy role #250
Open
kayiwa
wants to merge
3
commits into
main
Choose a base branch
from
i45_deploy_role
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,39 @@ | ||
Role Name | ||
========= | ||
|
||
Role that deploys CDH applications | ||
|
||
Requirements | ||
------------ | ||
|
||
GitHub Organization with API deployment set up | ||
|
||
Role Variables | ||
-------------- | ||
|
||
```yaml | ||
github_token: "your_token" | ||
``` | ||
Dependencies | ||
------------ | ||
|
||
No dependencies | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: | ||
|
||
- hosts: servers | ||
roles: | ||
- { role: username.rolename, x: 42 } | ||
|
||
License | ||
------- | ||
|
||
Apache2 | ||
|
||
Author Information | ||
------------------ | ||
|
||
An optional section for the role authors to include contact information, or a website (HTML is not allowed). |
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,2 @@ | ||
--- | ||
# defaults file for roles/deploy |
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,2 @@ | ||
--- | ||
# handlers file for roles/deploy |
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,16 @@ | ||
--- | ||
galaxy_info: | ||
role_name: deploy | ||
company: Princeton University Library | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CDH ? or both CDH & PUL ? |
||
description: deploy | ||
author: cdh | ||
|
||
license: Apache2 | ||
|
||
min_ansible_version: 2.2 | ||
|
||
platforms: | ||
- name: Ubuntu | ||
versions: | ||
- jammy | ||
dependencies: [] |
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,15 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
vars: | ||
- running_on_server: false | ||
become: true | ||
pre_tasks: | ||
- name: Update cache | ||
ansible.builtin.apt: | ||
update_cache: true | ||
cache_valid_time: 600 | ||
tasks: | ||
- name: "Include example" | ||
ansible.builtin.include_role: | ||
name: deploy |
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,22 @@ | ||
--- | ||
scenario: | ||
name: default | ||
driver: | ||
name: docker | ||
lint: | | ||
set -e | ||
yamllint . | ||
ansible-lint | ||
platforms: | ||
- name: instance | ||
image: "ghcr.io/pulibrary/pul_containers:jammy_multi" | ||
command: "sleep infinity" | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:ro | ||
privileged: true | ||
pre_build_image: true | ||
provisioner: | ||
name: ansible | ||
log: true | ||
verifier: | ||
name: ansible |
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,52 @@ | ||
--- | ||
- name: Verify | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
vars: | ||
deployments_endpoint: "https://api.github.com/repos/Princeton-CDH/cdh-ansible/deployments" | ||
gitref: "main" | ||
runtime_env: "production" | ||
deploy_description: "Test deployment" | ||
deploy_contexts: [] | ||
github_token: "your-github-token" | ||
|
||
tasks: | ||
- name: Include the role | ||
ansible.builtin.include_role: | ||
name: deploy | ||
|
||
- name: Assert deployment was created | ||
ansible.builtin.assert: | ||
that: | ||
- deployment is defined | ||
- deployment.status == 201 | ||
|
||
- name: Assert deployment status is pending | ||
ansible.builtin.uri: | ||
url: "{{ deployment.json.url }}" | ||
headers: | ||
Authorization: "token {{ github_token }}" | ||
register: deployment_status | ||
|
||
- name: Assert deployment status is pending | ||
ansible.builtin.assert: | ||
that: | ||
- deployment_status.json.state == "pending" | ||
|
||
- name: Run close_deployment task | ||
ansible.builtin.include_tasks: | ||
file: roles/deploy/tasks/main.yml | ||
tags: gh_deploy | ||
|
||
- name: Assert deployment status is success | ||
ansible.builtin.uri: | ||
url: "{{ deployment.json.url }}" | ||
headers: | ||
Authorization: "token {{ github_token }}" | ||
register: deployment_status | ||
|
||
- name: Assert deployment status is success | ||
ansible.builtin.assert: | ||
that: | ||
- deployment_status.json.state == "success" |
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
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,2 @@ | ||
--- | ||
# vars file for roles/deploy |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.