Skip to content

Commit 1dc27e4

Browse files
authored
Hcp devsecops v1.1.0 (#5815)
* initial commit * add gitea webhook and event listener * fix argo app * update * update * update * update * update * update * update * update * update * update
1 parent 5a49169 commit 1dc27e4

25 files changed

+1023
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Role Name
2+
=========
3+
4+
A brief description of the role goes here.
5+
6+
Requirements
7+
------------
8+
9+
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
10+
11+
Role Variables
12+
--------------
13+
14+
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
15+
16+
Dependencies
17+
------------
18+
19+
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
20+
21+
Example Playbook
22+
----------------
23+
24+
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
25+
26+
- hosts: servers
27+
roles:
28+
- { role: username.rolename, x: 42 }
29+
30+
License
31+
-------
32+
33+
BSD
34+
35+
Author Information
36+
------------------
37+
38+
An optional section for the role authors to include contact information, or a website (HTML is not allowed) .
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
# defaults file for ocp4_workload_multicluster_devsecops_demo
3+
4+
ocp4_username: admin
5+
6+
ocp4_workload_multicluster_devsecops_validated_pattern_sonarqube_namespace: sonarqube
7+
ocp4_workload_multicluster_devsecops_validated_pattern_ci_namespace: ci
8+
9+
ocp4_workload_multicluster_devsecops_validated_pattern_docker_username: quayadmin
10+
ocp4_workload_multicluster_devsecops_validated_pattern_docker_password: "{{ common_password }}"
11+
12+
ocp4_workload_multicluster_devsecops_validated_pattern_stackrox_namespace: stackrox
13+
14+
ocp4_workload_multicluster_devsecops_validated_pattern_cosign_password: 123
15+
16+
ocp4_workload_multicluster_devsecops_validated_pattern_dev_cluster: aws-dev-cluster
17+
18+
ocp4_workload_multicluster_devsecops_validated_pattern_inform_only_policies:
19+
- Fixable Severity at least Important
20+
21+
ocp4_workload_multicluster_devsecops_validated_pattern_gitea_username: dev-user
22+
ocp4_workload_multicluster_devsecops_validated_pattern_gitea_password: openshift
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-----BEGIN ENCRYPTED COSIGN PRIVATE KEY-----
2+
eyJrZGYiOnsibmFtZSI6InNjcnlwdCIsInBhcmFtcyI6eyJOIjozMjc2OCwiciI6
3+
OCwicCI6MX0sInNhbHQiOiJKQ2pKVGpGVzVxUGNBWDBmN2hQM1l2b09WNlBMWXVU
4+
V1B2OWNIenk1TEFBPSJ9LCJjaXBoZXIiOnsibmFtZSI6Im5hY2wvc2VjcmV0Ym94
5+
Iiwibm9uY2UiOiJURjEwUXpQMjN0NkNLVWx6dmtxUmNxZ0ZaNjF6UlFXbSJ9LCJj
6+
aXBoZXJ0ZXh0IjoicGdwampyZ0J4T05mSGpPR29YM3hTZU8xRC9ma3FmaDdCRXBV
7+
QjNpcU1kQ1U4OUk4dU9FMVR5aXpJbmlEM25Ub2cvKzEza2ozRTlzNFIxeGtLTnhN
8+
S1dVVnBXd1cxV3JGcEc2TEZQVXNLQU9EdFd3YTNQL0FNNjZEOUQyMUFDT2REZURl
9+
U0NIYXZVZld4ODdQRm0zeDN5bXZHNmNIVm0rVDk5Rnd4QzFrMmVya0x6TzdwY2J5
10+
TDhRSGdDeE9xa29BeVh5bWpkRjM5N3dPTWc9PSJ9
11+
-----END ENCRYPTED COSIGN PRIVATE KEY-----
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-----BEGIN PUBLIC KEY-----
2+
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEVgNgC/bFhzWarqL9biuznN33R5Ux
3+
SBWSt9QHq90CdfodBsrmINdA7dgYKYChHJB/CrYPLm/H7b9U5Ul/DP7Mnw==
4+
-----END PUBLIC KEY-----
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# handlers file for ocp4_workload_multicluster_devsecops_demo
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
galaxy_info:
2+
author: your name
3+
description: your role description
4+
company: your company (optional)
5+
6+
# If the issue tracker for your role is not on github, uncomment the
7+
# next line and provide a value
8+
# issue_tracker_url: http://example.com/issue/tracker
9+
10+
# Choose a valid license ID from https://spdx.org - some suggested licenses:
11+
# - BSD-3-Clause (default)
12+
# - MIT
13+
# - GPL-2.0-or-later
14+
# - GPL-3.0-only
15+
# - Apache-2.0
16+
# - CC-BY-4.0
17+
license: license (GPL-2.0-or-later, MIT, etc)
18+
19+
min_ansible_version: 2.9
20+
21+
# If this a Container Enabled role, provide the minimum Ansible Container version.
22+
# min_ansible_container_version:
23+
24+
#
25+
# Provide a list of supported platforms, and for each platform a list of versions.
26+
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
27+
# To view available platforms and versions (or releases), visit:
28+
# https://galaxy.ansible.com/api/v1/platforms/
29+
#
30+
# platforms:
31+
# - name: Fedora
32+
# versions:
33+
# - all
34+
# - 25
35+
# - name: SomePlatform
36+
# versions:
37+
# - all
38+
# - 1.0
39+
# - 7
40+
# - 99.99
41+
42+
galaxy_tags: []
43+
# List tags for your role here, one per line. A tag is a keyword that describes
44+
# and categorizes the role. Users find roles by searching for tags. Be sure to
45+
# remove the '[]' above, if you add tags to this list.
46+
#
47+
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
48+
# Maximum 20 tags per role.
49+
50+
dependencies: []
51+
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
52+
# if you add dependencies to this list.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
- name: Fetch template from remote host
3+
run_once: true
4+
fetch:
5+
src: "{{ _folder }}/{{ item }}"
6+
dest: /tmp/{{ item }}
7+
flat: yes
8+
fail_on_missing: yes
9+
10+
- name: Apply template
11+
ansible.builtin.template:
12+
src: /tmp/{{ item }}
13+
dest: "{{ _folder }}/{{ item }}"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
- name: Get "{{ item }}" policy
2+
set_fact:
3+
policy_id: "{{ r_policies|json_query('json.policies[?name == `{}`]|[0].id'.format(item)) }}"
4+
5+
- name: Get Stackrox policy {{ policy_id }}
6+
uri:
7+
url: "{{ _ocp4_workload_multicluster_devsecops_validated_pattern_centeral_stackrox_url }}/v1/policies/{{ policy_id }}"
8+
user: admin
9+
password: "{{ common_password }}"
10+
method: GET
11+
force_basic_auth: true
12+
validate_certs: false
13+
body_format: json
14+
headers:
15+
Content-Type: application/json
16+
register: r_policy
17+
18+
- name: Read into fact
19+
ansible.builtin.set_fact:
20+
policy_fact: "{{ r_policy.json }}"
21+
22+
- name: Update the fact to remove enforcement actions
23+
ansible.utils.update_fact:
24+
updates:
25+
- path: policy_fact.enforcementActions
26+
value: []
27+
register: updated_policy
28+
29+
- name: Update Stackrox Policy {{ policy_id }}
30+
uri:
31+
url: "{{ _ocp4_workload_multicluster_devsecops_validated_pattern_centeral_stackrox_url }}/v1/policies/{{ policy_id }}"
32+
user: admin
33+
password: "{{ common_password }}"
34+
method: PUT
35+
force_basic_auth: true
36+
validate_certs: false
37+
body_format: json
38+
headers:
39+
Content-Type: application/json
40+
body: "{{ updated_policy.policy_fact }}"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
# Do not modify this file
3+
4+
- name: Running Pre Workload Tasks
5+
include_tasks:
6+
file: ./pre_workload.yml
7+
apply:
8+
become: "{{ become_override | bool }}"
9+
when: ACTION == "create" or ACTION == "provision"
10+
11+
- name: Running Workload Tasks
12+
include_tasks:
13+
file: ./workload.yml
14+
apply:
15+
become: "{{ become_override | bool }}"
16+
when: ACTION == "create" or ACTION == "provision"
17+
18+
- name: Running Post Workload Tasks
19+
include_tasks:
20+
file: ./post_workload.yml
21+
apply:
22+
become: "{{ become_override | bool }}"
23+
when: ACTION == "create" or ACTION == "provision"
24+
25+
- name: Running Workload removal Tasks
26+
include_tasks:
27+
file: ./remove_workload.yml
28+
apply:
29+
become: "{{ become_override | bool }}"
30+
when: ACTION == "destroy" or ACTION == "remove"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
# Implement your Post Workload deployment tasks here
3+
# --------------------------------------------------
4+
5+
6+
# Leave these as the last tasks in the playbook
7+
# ---------------------------------------------
8+
9+
# For deployment onto a dedicated cluster (as part of the
10+
# cluster deployment) set workload_shared_deployment to False
11+
# This is the default so it does not have to be set explicitely
12+
- name: post_workload tasks complete
13+
debug:
14+
msg: "Post-Workload tasks completed successfully."
15+
when:
16+
- not silent | bool
17+
- not workload_shared_deployment | default(false) | bool
18+
19+
# For RHPDS deployment (onto a shared cluster) set
20+
# workload_shared_deployment to True
21+
# (in the deploy script or AgnosticV configuration)
22+
- name: post_workload tasks complete
23+
debug:
24+
msg: "Post-Software checks completed successfully"
25+
when:
26+
- not silent | bool
27+
- workload_shared_deployment | default(false) | bool

0 commit comments

Comments
 (0)