antelope-cli 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ansible/onboarding-ca/README.md +105 -105
- package/ansible/onboarding-ca/onboard-ca.yml +43 -51
- package/ansible/onboarding-ca/requirements.yml +8 -8
- package/ansible/onboarding-ca/roles/onboard_ca/defaults/main.yml +77 -49
- package/ansible/onboarding-ca/roles/onboard_ca/meta/main.yml +10 -10
- package/ansible/onboarding-ca/roles/onboard_ca/tasks/main.yml +311 -193
- package/ansible/onboarding-ca/roles/onboard_ca/tasks/per_branch.yml +114 -107
- package/ansible/onboarding-ca/roles/onboard_ca/vars/main.yml +9 -9
- package/ansible/onboarding-crm/README.md +107 -0
- package/ansible/onboarding-crm/onboard-crm.yml +60 -0
- package/ansible/onboarding-crm/requirements.yml +8 -0
- package/ansible/onboarding-crm/roles/onboard_crm/defaults/main.yml +99 -0
- package/ansible/onboarding-crm/roles/onboard_crm/meta/main.yml +10 -0
- package/ansible/onboarding-crm/roles/onboard_crm/tasks/main.yml +324 -0
- package/ansible/onboarding-crm/roles/onboard_crm/tasks/per_branch.yml +121 -0
- package/ansible/onboarding-crm/roles/onboard_crm/vars/main.yml +9 -0
- package/index.js +12 -12
- package/onboarding/brand.js +21 -21
- package/onboarding/createConfig.js +71 -71
- package/onboarding/favicon.js +24 -24
- package/onboarding/index.js +62 -62
- package/onboarding/logo.js +16 -16
- package/onboarding/themes.js +92 -92
- package/onboarding/translations.js +41 -41
- package/onboarding/variablesColors.js +58 -58
- package/onboarding-ca/brand.js +13 -13
- package/onboarding-ca/index.js +94 -94
- package/onboarding-ca/riskDisclaimer.js +27 -27
- package/onboarding-ca/scss.js +24 -24
- package/onboarding-ca/templates/risk-disclaimer.html +12 -12
- package/onboarding-crm/brand.js +22 -22
- package/onboarding-crm/brandLogos.js +31 -0
- package/onboarding-crm/createConfig.js +40 -40
- package/onboarding-crm/index.js +175 -171
- package/onboarding-crm/themes.js +92 -92
- package/onboarding-crm/variablesColors.js +53 -53
- package/package.json +30 -30
|
@@ -1,107 +1,114 @@
|
|
|
1
|
-
---
|
|
2
|
-
# Runs once per destination branch. `dest_branch` is the loop var.
|
|
3
|
-
|
|
4
|
-
- name: "[{{ dest_branch }}] Compose source branch name"
|
|
5
|
-
ansible.builtin.set_fact:
|
|
6
|
-
branch_prefix: "{{ 'hotfix' if dest_branch is match('(master|release)') else 'feature' }}"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- name: "[{{ dest_branch }}]
|
|
13
|
-
ansible.builtin.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- name: "[{{ dest_branch }}]
|
|
36
|
-
ansible.builtin.command:
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
1
|
+
---
|
|
2
|
+
# Runs once per destination branch. `dest_branch` is the loop var.
|
|
3
|
+
|
|
4
|
+
- name: "[{{ dest_branch }}] Compose source branch name"
|
|
5
|
+
ansible.builtin.set_fact:
|
|
6
|
+
branch_prefix: "{{ 'hotfix' if dest_branch is match('(master|release)') else 'feature' }}"
|
|
7
|
+
|
|
8
|
+
# Suffix the release version onto master/release targets so each destination gets its OWN
|
|
9
|
+
# source branch. Without it, master-27.0 and master-27.1 (both present during a staged
|
|
10
|
+
# release, e.g. after a code freeze) collapse to one hotfix branch → the 2nd PR reuses the
|
|
11
|
+
# 1st's branch (wrong base) and close_source_branch on either merge kills the other PR.
|
|
12
|
+
- name: "[{{ dest_branch }}] Set source branch"
|
|
13
|
+
ansible.builtin.set_fact:
|
|
14
|
+
source_branch: >-
|
|
15
|
+
{{ branch_prefix }}/{{ jira_key_client_branding }}-onboarding-{{ brand_assets_folder }}{{
|
|
16
|
+
('-' ~ (dest_branch | regex_replace('^(master|release)-', '')))
|
|
17
|
+
if dest_branch is match('(master|release)') else '' }}
|
|
18
|
+
|
|
19
|
+
- name: "[{{ dest_branch }}] Fetch all remote branches"
|
|
20
|
+
ansible.builtin.command:
|
|
21
|
+
cmd: git fetch origin --prune
|
|
22
|
+
chdir: "{{ work_dir }}"
|
|
23
|
+
changed_when: false
|
|
24
|
+
|
|
25
|
+
- name: "[{{ dest_branch }}] Does the source branch already exist on origin?"
|
|
26
|
+
ansible.builtin.command:
|
|
27
|
+
cmd: "git ls-remote --exit-code --heads origin {{ source_branch }}"
|
|
28
|
+
chdir: "{{ work_dir }}"
|
|
29
|
+
register: remote_src
|
|
30
|
+
failed_when: false
|
|
31
|
+
changed_when: false
|
|
32
|
+
|
|
33
|
+
# Base the working branch on its own remote head if it already exists (idempotent re-run),
|
|
34
|
+
# otherwise on the destination branch.
|
|
35
|
+
- name: "[{{ dest_branch }}] Check out the working branch"
|
|
36
|
+
ansible.builtin.command:
|
|
37
|
+
cmd: >-
|
|
38
|
+
git checkout -B {{ source_branch }}
|
|
39
|
+
{{ ('origin/' + source_branch) if remote_src.rc == 0 else ('origin/' + dest_branch) }}
|
|
40
|
+
chdir: "{{ work_dir }}"
|
|
41
|
+
|
|
42
|
+
- name: "[{{ dest_branch }}] Generate brand files via antelope-cli"
|
|
43
|
+
ansible.builtin.command:
|
|
44
|
+
argv:
|
|
45
|
+
- npx
|
|
46
|
+
- "antelope-cli@{{ antelope_cli_version }}"
|
|
47
|
+
- onboarding-ca
|
|
48
|
+
- --brand_assets_folder
|
|
49
|
+
- "{{ brand_assets_folder }}"
|
|
50
|
+
chdir: "{{ work_dir }}"
|
|
51
|
+
environment:
|
|
52
|
+
CI: "true"
|
|
53
|
+
changed_when: true
|
|
54
|
+
|
|
55
|
+
- name: "[{{ dest_branch }}] Stage changes"
|
|
56
|
+
ansible.builtin.command:
|
|
57
|
+
cmd: git add -A
|
|
58
|
+
chdir: "{{ work_dir }}"
|
|
59
|
+
changed_when: false
|
|
60
|
+
|
|
61
|
+
- name: "[{{ dest_branch }}] Detect staged changes"
|
|
62
|
+
ansible.builtin.command:
|
|
63
|
+
cmd: git diff --cached --quiet
|
|
64
|
+
chdir: "{{ work_dir }}"
|
|
65
|
+
register: staged
|
|
66
|
+
failed_when: false
|
|
67
|
+
changed_when: false
|
|
68
|
+
|
|
69
|
+
- name: "[{{ dest_branch }}] Commit"
|
|
70
|
+
ansible.builtin.command:
|
|
71
|
+
cmd: >-
|
|
72
|
+
git -c user.name="{{ git_user_name }}" -c user.email="{{ git_user_email }}"
|
|
73
|
+
commit -m "{{ jira_key_client_branding }}: On-Boarding {{ brand_name }} Client Branding"
|
|
74
|
+
chdir: "{{ work_dir }}"
|
|
75
|
+
when: staged.rc == 1
|
|
76
|
+
|
|
77
|
+
- name: "[{{ dest_branch }}] Push source branch"
|
|
78
|
+
ansible.builtin.command:
|
|
79
|
+
cmd: "git push -u origin {{ source_branch }}"
|
|
80
|
+
chdir: "{{ work_dir }}"
|
|
81
|
+
when: staged.rc == 1
|
|
82
|
+
|
|
83
|
+
- name: "[{{ dest_branch }}] Open pull request"
|
|
84
|
+
ansible.builtin.uri:
|
|
85
|
+
url: "{{ api_base }}/repositories/{{ workspace }}/{{ repo_slug }}/pullrequests"
|
|
86
|
+
method: POST
|
|
87
|
+
url_username: "{{ bitbucket_email }}"
|
|
88
|
+
url_password: "{{ bitbucket_token }}"
|
|
89
|
+
force_basic_auth: true
|
|
90
|
+
body_format: json
|
|
91
|
+
body:
|
|
92
|
+
title: "{{ jira_key_client_branding }}: On-Boarding {{ brand_name }} Client Branding"
|
|
93
|
+
description: "{{ jira_key_client_branding }}: On-Boarding {{ brand_name }} Client Branding"
|
|
94
|
+
source:
|
|
95
|
+
branch:
|
|
96
|
+
name: "{{ source_branch }}"
|
|
97
|
+
destination:
|
|
98
|
+
branch:
|
|
99
|
+
name: "{{ dest_branch }}"
|
|
100
|
+
reviewers: "{{ reviewers }}"
|
|
101
|
+
close_source_branch: true
|
|
102
|
+
return_content: true
|
|
103
|
+
status_code: [201, 400] # 400 tolerated: a PR for this source->dest already exists
|
|
104
|
+
register: pr_response
|
|
105
|
+
|
|
106
|
+
- name: "[{{ dest_branch }}] Record PR result"
|
|
107
|
+
ansible.builtin.set_fact:
|
|
108
|
+
pr_results: >-
|
|
109
|
+
{{ (pr_results | default([])) + [{
|
|
110
|
+
'destination': dest_branch,
|
|
111
|
+
'source': source_branch,
|
|
112
|
+
'status': pr_response.status,
|
|
113
|
+
'url': (pr_response.json.links.html.href | default('(already exists or not created)'))
|
|
114
|
+
}] }}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
---
|
|
2
|
-
# Constants — the target repository for Client Area onboarding.
|
|
3
|
-
api_base: "https://api.bitbucket.org/2.0"
|
|
4
|
-
workspace: "xsitesinc"
|
|
5
|
-
repo_slug: "web-client-area"
|
|
6
|
-
repo_ssh_url: "git@bitbucket.org:xsitesinc/web-client-area.git"
|
|
7
|
-
|
|
8
|
-
# Consul (v2 cluster) — source of the release train used to derive destination branches.
|
|
9
|
-
consul_url: "https://consul.xsites.xyz"
|
|
1
|
+
---
|
|
2
|
+
# Constants — the target repository for Client Area onboarding.
|
|
3
|
+
api_base: "https://api.bitbucket.org/2.0"
|
|
4
|
+
workspace: "xsitesinc"
|
|
5
|
+
repo_slug: "web-client-area"
|
|
6
|
+
repo_ssh_url: "git@bitbucket.org:xsitesinc/web-client-area.git"
|
|
7
|
+
|
|
8
|
+
# Consul (v2 cluster) — source of the release train used to derive destination branches.
|
|
9
|
+
consul_url: "https://consul.xsites.xyz"
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# CRM brand onboarding (Ansible)
|
|
2
|
+
|
|
3
|
+
Automates onboarding a new CRM brand into
|
|
4
|
+
[`web-crm`](https://bitbucket.org/xsitesinc/web-crm): it creates the brand assets and opens
|
|
5
|
+
the pull request(s). Sister automation to [`../onboarding-ca`](../onboarding-ca) — same
|
|
6
|
+
clone / branch / commit / push / PR + Consul-derived branches + 1Password tokens + Jira
|
|
7
|
+
Fix Version pattern, targeting `web-crm` instead of `web-client-area`.
|
|
8
|
+
|
|
9
|
+
Per brand, in the target repo (all delegated to `npx antelope-cli@<version> onboarding-crm`):
|
|
10
|
+
|
|
11
|
+
- `src/ng1/assets/css/sass/variables-colors.scss` — `$<id>` shades + `$colors` entry
|
|
12
|
+
- `src/ng1/assets/css/sass/materialism/themes.scss` — theme maps + `.theme-template-<id>` block
|
|
13
|
+
- `src/assets/brands/<id>/languages/<lang>.json` — one empty file per language
|
|
14
|
+
- `src/configs/configs.ts` — rewritten for the brand (copy into the env's Consul config; gitignored, not committed)
|
|
15
|
+
- `src/configs/brand-logos.json` — `"theme-template-<id>": "<logo_url>"` entry (the committed logo registry)
|
|
16
|
+
- `BRAND_LOCATIONS.md` — sprint-tracking row `<name> -> <id>`
|
|
17
|
+
|
|
18
|
+
This role owns cloning, branching, committing, pushing and PR creation.
|
|
19
|
+
|
|
20
|
+
## Preconditions (control node)
|
|
21
|
+
|
|
22
|
+
- `git`, Node.js (engines `^16.20.2`) and `npx` on `PATH`.
|
|
23
|
+
- An **SSH key authorized to push** to `xsitesinc/web-crm` (push is over SSH).
|
|
24
|
+
- An **Atlassian API token** (`ATATT…`) for the account in `bitbucket_email`, carrying Bitbucket
|
|
25
|
+
scopes `read:user`, `read:repository`, `read:pullrequest`, `write:pullrequest`. Used only for the
|
|
26
|
+
REST calls (reviewer lookup + PR creation) via **HTTP Basic auth** (`email:token`) — these tokens
|
|
27
|
+
are **not** Bearer tokens. Provide via `--extra-vars` / Ansible Vault, or leave it blank and let
|
|
28
|
+
the playbook fetch it from 1Password (item `jenkins@xsites.co.il`, field `bitbucket_scoped_token`).
|
|
29
|
+
- A **Consul token** with `read` scope on `version/*` (v2 cluster) — used to derive the destination
|
|
30
|
+
branches. Provide via `-e consul_token=…`, `$CONSUL_HTTP_TOKEN`, or the 1Password item
|
|
31
|
+
`New_Consul_Token` / `password`. Not needed when you pass an explicit `dest_branches` override.
|
|
32
|
+
- A **Jira token** (personal ATATT, `jira_email` owns it) for the Fix Version step — see below. Blank
|
|
33
|
+
⇒ fetched from 1Password (`xvouzkhjw55xffdwyzk5npi2mu` / `my_attlasian_token`). The jenkins service
|
|
34
|
+
account has **no Jira seat**, so its tokens 401 on Jira — use a personal Jira-enabled token.
|
|
35
|
+
- A **signed-in `op` CLI** (`op signin`, or `OP_SERVICE_ACCOUNT_TOKEN`) if you rely on the 1Password
|
|
36
|
+
fallbacks above instead of passing the tokens explicitly.
|
|
37
|
+
- The **`community.general`** collection: `ansible-galaxy collection install -r requirements.yml`.
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
Interactive (prompts for the inputs):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
ansible-playbook onboard-crm.yml
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Non-interactive (tokens fall back to 1Password; branches derived from Consul):
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
ansible-playbook onboard-crm.yml \
|
|
51
|
+
-e antelope_id=xyzxx \
|
|
52
|
+
-e brand_name="Zenith Horizon Group" \
|
|
53
|
+
-e crm_type=CORP_FL \
|
|
54
|
+
-e logo_url=https://.../logo.png \
|
|
55
|
+
-e favicon_url=https://.../favicon.png \
|
|
56
|
+
-e languages=en,ar \
|
|
57
|
+
-e fcm_sender_id=123456789 \
|
|
58
|
+
-e jira_key_crm_branding=ATLP-47067
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Note: pass token values literally (or via a shell variable). Do **not** prefix a raw `ATATT…`
|
|
62
|
+
token with `$` — the shell would try to expand it and send an empty token.
|
|
63
|
+
|
|
64
|
+
## Inputs
|
|
65
|
+
|
|
66
|
+
| var | required | example | notes |
|
|
67
|
+
|-----|----------|---------|-------|
|
|
68
|
+
| `antelope_id` | yes | `xyzxx` | Antelope ID → CLI `--brand_id`; keys every generated file + the branch name (normalized lowercase/no-spaces) |
|
|
69
|
+
| `brand_name` | yes | `Zenith Horizon Group` | → CLI `--brand_name`, PR title, configs title |
|
|
70
|
+
| `crm_type` | yes | `CORP_FL` | → CLI `--type`; one of `CORP_FL`, `IB_FL`, `CORP_AFF_FL`, `CORP_AFF_IB_PORTAL`, `CORP_AFF_MSQ` |
|
|
71
|
+
| `logo_url` | yes | *(url)* | → CLI `--logo_url` (black-background logo) |
|
|
72
|
+
| `favicon_url` | yes | *(url)* | → CLI `--favicon_url` |
|
|
73
|
+
| `languages` | yes | `en,ar` | → CLI `--languages`; CSV string **or** a YAML list (`[en, ar]`) |
|
|
74
|
+
| `fcm_sender_id` | yes | `123456789` | → CLI `--fcm_sender_id` (Firebase) |
|
|
75
|
+
| `jira_key_crm_branding` | yes | `ATLP-47067` | PR title prefix + branch name + Jira Fix Version target |
|
|
76
|
+
| `color` | no | `#1a2b3c` | → CLI `--color`; blank ⇒ default `$corp` palette |
|
|
77
|
+
| `base_url` | no | *(url)* | → CLI `--base_url` (configs.ts baseUrl); blank ⇒ CLI default (dev URL) |
|
|
78
|
+
| `bitbucket_token` | no* | *(secret)* | Bitbucket API token; *blank ⇒ 1Password (`jenkins@xsites.co.il` / `bitbucket_scoped_token`)* |
|
|
79
|
+
| `bitbucket_email` | yes | `jenkins@xsites.co.il` | account that owns the token; defaults to the Jenkins service account |
|
|
80
|
+
| `dest_branches` | no | `develop,master-27.0` | comma-separated override; **blank ⇒ derived from Consul**. One PR per branch |
|
|
81
|
+
| `consul_token` | no* | *(secret)* | read scope on `version/*`; *blank ⇒ `$CONSUL_HTTP_TOKEN`, else 1Password (`New_Consul_Token` / `password`)*. Unused when `dest_branches` is set |
|
|
82
|
+
| `jira_token` / `jira_email` | no* | *(secret)* / `eldadp@…` | Jira Basic auth for the Fix Version step; *blank token ⇒ 1Password (`xvouzkhjw55xffdwyzk5npi2mu` / `my_attlasian_token`)* |
|
|
83
|
+
| `manage_jira_fix_version` | no | `true` | set `false` to skip the Fix Version stamping |
|
|
84
|
+
| `reviewers` | no | *(auto)* | default: repo's Bitbucket default-reviewers (author excluded) |
|
|
85
|
+
| `antelope_cli_version` | no | `1.2.3` | pinned published CLI version |
|
|
86
|
+
| `work_dir` | no | `/tmp/onboard-crm/web-crm` | clone location |
|
|
87
|
+
|
|
88
|
+
## Behavior notes
|
|
89
|
+
|
|
90
|
+
- **Destination branches are derived from the release train in Consul** (unless `dest_branches`
|
|
91
|
+
is passed): `develop` always; `master-<version/prod>`; and `master-<version/staging>` too while a
|
|
92
|
+
release is staged (`version/staging != version/prod`).
|
|
93
|
+
- **One PR per destination branch.** `develop` → `feature/<jira>-onboarding-crm-<id>`;
|
|
94
|
+
`master-*`/`release-*` → `hotfix/<jira>-onboarding-crm-<id>-<ver>` (the `-<ver>` suffix keeps the
|
|
95
|
+
two master branches of a staged release from colliding onto one source branch).
|
|
96
|
+
- **Jira Fix Version** `V<version/prod>` (+ `V<version/staging>` when staged) is stamped on
|
|
97
|
+
`jira_key_crm_branding` **before** the push, so the web-crm DangerJS pipeline is green on first run.
|
|
98
|
+
Additive/idempotent; non-fatal if the token/version is missing (warns and skips).
|
|
99
|
+
- **Reviewers** come from the repo's Bitbucket *Default reviewers* config; the authenticating account
|
|
100
|
+
is excluded (Bitbucket rejects a PR whose author is a reviewer).
|
|
101
|
+
- **Idempotent:** re-running recreates the identical files on the existing source branch, detects no
|
|
102
|
+
staged changes, skips commit/push, and tolerates the "PR already exists" 400.
|
|
103
|
+
|
|
104
|
+
## Scope
|
|
105
|
+
|
|
106
|
+
CRM only (`web-crm`). Client-Area onboarding is the separate [`../onboarding-ca`](../onboarding-ca)
|
|
107
|
+
playbook.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Onboard a CRM brand into web-crm and open the PR(s).
|
|
3
|
+
#
|
|
4
|
+
# Destination branches are derived from the release train in Consul (no manual input):
|
|
5
|
+
# develop is always onboarded; master-<version/prod> tracks the live release; while a
|
|
6
|
+
# new release is staged (version/staging != version/prod) its master-<version/staging>
|
|
7
|
+
# exists too and is onboarded as well. Pass -e dest_branches=... to override the lookup.
|
|
8
|
+
#
|
|
9
|
+
# Interactive:
|
|
10
|
+
# ansible-playbook onboard-crm.yml
|
|
11
|
+
#
|
|
12
|
+
# Non-interactive (e.g. from another playbook / CI), pass everything as extra-vars:
|
|
13
|
+
# ansible-playbook onboard-crm.yml \
|
|
14
|
+
# -e antelope_id=xyzxx \
|
|
15
|
+
# -e brand_name="Zenith Horizon Group" \
|
|
16
|
+
# -e crm_type=CORP_FL \
|
|
17
|
+
# -e logo_url=https://.../logo.png \
|
|
18
|
+
# -e favicon_url=https://.../favicon.png \
|
|
19
|
+
# -e languages=en,ar \
|
|
20
|
+
# -e fcm_sender_id=123456789 \
|
|
21
|
+
# -e jira_key_crm_branding=ATLP-47067 \
|
|
22
|
+
# -e consul_token="$CONSUL_HTTP_TOKEN" \ # read scope on version/*; used to derive dest branches
|
|
23
|
+
# -e bitbucket_email=jenkins@xsites.co.il \
|
|
24
|
+
# -e bitbucket_token=ATATT3x... # Atlassian API token WITHOUT a leading '$' (it is a literal, not a shell var)
|
|
25
|
+
|
|
26
|
+
# Preconditions on the control node: git + Node (>=16) + npx, an SSH key authorized to
|
|
27
|
+
# push to xsitesinc/web-crm, and an Atlassian API token (ATATT…) owned by bitbucket_email,
|
|
28
|
+
# carrying Bitbucket scopes read:user / read:repository / read+write:pullrequest. The token
|
|
29
|
+
# is used via HTTP Basic auth (email:token).
|
|
30
|
+
- name: Onboard a CRM brand (web-crm)
|
|
31
|
+
hosts: localhost
|
|
32
|
+
connection: local
|
|
33
|
+
gather_facts: false
|
|
34
|
+
|
|
35
|
+
# Only the required, non-defaulted inputs are prompted. Everything else comes from role
|
|
36
|
+
# defaults: favicon_url + base_url derive from antelope_id/brand_name/crm_server_url; color
|
|
37
|
+
# blank => default palette; bitbucket_email = jenkins service account; bitbucket/consul/jira
|
|
38
|
+
# tokens from 1Password. Override any with -e (e.g. -e base_url=… when crm_server_url is unset).
|
|
39
|
+
vars_prompt:
|
|
40
|
+
- name: antelope_id
|
|
41
|
+
prompt: "Brand Antelope ID — the code identifier used everywhere (e.g. xyzxx)"
|
|
42
|
+
private: false
|
|
43
|
+
- name: brand_name
|
|
44
|
+
prompt: "Brand display name — recorded in BRAND_LOCATIONS.md / configs title (e.g. Zenith Horizon Group)"
|
|
45
|
+
private: false
|
|
46
|
+
- name: crm_type
|
|
47
|
+
prompt: "CRM type (one of: CORP_FL, IB_FL, CORP_AFF_FL, CORP_AFF_IB_PORTAL, CORP_AFF_MSQ)"
|
|
48
|
+
private: false
|
|
49
|
+
- name: languages
|
|
50
|
+
prompt: "Languages — 2-letter codes, comma-separated (e.g. en,ar)"
|
|
51
|
+
private: false
|
|
52
|
+
- name: fcm_sender_id
|
|
53
|
+
prompt: "Firebase FCMSenderId"
|
|
54
|
+
private: false
|
|
55
|
+
- name: jira_key_crm_branding
|
|
56
|
+
prompt: "Jira key (e.g. ATLP-47067)"
|
|
57
|
+
private: false
|
|
58
|
+
|
|
59
|
+
roles:
|
|
60
|
+
- onboard_crm
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Ansible collection dependencies for the onboarding-ca playbook.
|
|
3
|
+
# Install with: ansible-galaxy collection install -r requirements.yml
|
|
4
|
+
collections:
|
|
5
|
+
# Provides the community.general.dict_kv filter used to build the Bitbucket
|
|
6
|
+
# reviewers array (roles/onboard_ca/tasks/main.yml).
|
|
7
|
+
- name: community.general
|
|
8
|
+
version: ">=8.0.0"
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Pinned published antelope-cli version that provides the `onboarding-crm` command.
|
|
3
|
+
antelope_cli_version: "1.2.3"
|
|
4
|
+
|
|
5
|
+
# Where web-crm is cloned on the control node.
|
|
6
|
+
work_dir: "/tmp/onboard-crm/web-crm"
|
|
7
|
+
|
|
8
|
+
# --- CRM brand inputs (map to the `onboarding-crm` CLI flags) ------------------------
|
|
9
|
+
# antelope_id => --brand_id (Antelope unique ID / connectedBrandName; keys every file the CLI writes)
|
|
10
|
+
# brand_name, languages, fcm_sender_id, crm_type are REQUIRED; logo_url/favicon_url/base_url derive.
|
|
11
|
+
# color is optional (blank => the CLI's $corp palette).
|
|
12
|
+
#
|
|
13
|
+
# favicon_url and base_url default to the SAME derivations as the deployment config
|
|
14
|
+
# (xsites-devops ansible-deployment-new/roles/consul/templates/crm.json.j2), so the values
|
|
15
|
+
# match what gets seeded into Consul. They resolve from the brand vars (antelope_id,
|
|
16
|
+
# brand_name, crm_server_url) in the create_brand context; the standalone playbook's prompts
|
|
17
|
+
# override them. crm_type is a per-brand value (not defaulted anywhere — set it in brand_vars
|
|
18
|
+
# or -e). logo_url has no derivation in that template — must be provided explicitly.
|
|
19
|
+
antelope_id: ""
|
|
20
|
+
color: "" # --color hex, e.g. "#1a2b3c"; blank => default palette
|
|
21
|
+
logo_url: "https://logos-{{ antelope_id }}.s3.eu-west-1.amazonaws.com/logo-{{ brand_name }}.png" # derived like favicon_url; override with -e
|
|
22
|
+
languages: "" # --languages: CSV "en,ar" or a YAML list [en, ar]
|
|
23
|
+
fcm_sender_id: "" # --fcm_sender_id (Firebase) — blank in crm.json.j2 but the CLI requires it
|
|
24
|
+
crm_type: "" # --type: one of allowed_crm_types below (per-brand; set in brand_vars)
|
|
25
|
+
favicon_url: "https://logos-{{ antelope_id }}.s3.eu-west-1.amazonaws.com/favicon-{{ brand_name }}.png"
|
|
26
|
+
base_url: "{{ ('https://' ~ crm_server_url ~ '/SignalsCRM/') if (crm_server_url | default('') | length > 0) else '' }}"
|
|
27
|
+
# Kept in sync with ALLOWED_TYPES in antelope-cli/onboarding-crm/index.js.
|
|
28
|
+
allowed_crm_types:
|
|
29
|
+
- CORP_FL
|
|
30
|
+
- IB_FL
|
|
31
|
+
- CORP_AFF_FL
|
|
32
|
+
- CORP_AFF_IB_PORTAL
|
|
33
|
+
- CORP_AFF_MSQ
|
|
34
|
+
|
|
35
|
+
# Reviewers for the PR. Empty => auto-fetched from the repo's Bitbucket "Default reviewers"
|
|
36
|
+
# config (the authenticating account is excluded automatically). Override with an explicit
|
|
37
|
+
# list, e.g. [{ account_id: "..." }] or [{ uuid: "{...}" }], to bypass the lookup.
|
|
38
|
+
reviewers: []
|
|
39
|
+
|
|
40
|
+
# Identity used for the commit (control-node git may have no global config).
|
|
41
|
+
git_user_name: "Jenkins"
|
|
42
|
+
git_user_email: "jenkins@xsites.co.il"
|
|
43
|
+
|
|
44
|
+
# Atlassian API token (ATATT…) for the reviewer lookup + PR creation. Sent via HTTP
|
|
45
|
+
# Basic auth together with bitbucket_email — these tokens are NOT Bearer tokens and
|
|
46
|
+
# must carry Bitbucket scopes (read:user, read:repository, read/write:pullrequest).
|
|
47
|
+
# Empty => fetched from 1Password (see onepassword_bitbucket_* below). Provide via
|
|
48
|
+
# --extra-vars or Ansible Vault to skip the lookup; never commit a real value.
|
|
49
|
+
bitbucket_token: ""
|
|
50
|
+
|
|
51
|
+
# Email of the Atlassian account that owns bitbucket_token (the Basic-auth username).
|
|
52
|
+
# Defaults to the Jenkins service account; override via --extra-vars for a different account.
|
|
53
|
+
bitbucket_email: "jenkins@xsites.co.il"
|
|
54
|
+
|
|
55
|
+
# Consul token with read scope on version/* (v2 cluster). Used to derive the destination
|
|
56
|
+
# branches from the release train (version/prod, version/staging). Empty => resolved from
|
|
57
|
+
# $CONSUL_HTTP_TOKEN, else from 1Password (see onepassword_consul_* below). Not needed when
|
|
58
|
+
# an explicit dest_branches override is passed. Never commit a real value.
|
|
59
|
+
consul_token: ""
|
|
60
|
+
|
|
61
|
+
# Explicit destination-branch override (comma-separated). Empty => derived from Consul:
|
|
62
|
+
# develop + master-<version/prod> [+ master-<version/staging> while a release is staged].
|
|
63
|
+
# Set this to bypass the Consul lookup entirely, e.g. dest_branches=develop,master-26.9.
|
|
64
|
+
dest_branches: ""
|
|
65
|
+
|
|
66
|
+
# 1Password fallbacks — used only when the corresponding token is not otherwise provided.
|
|
67
|
+
# Require a signed-in `op` CLI on the control node (op signin, or OP_SERVICE_ACCOUNT_TOKEN).
|
|
68
|
+
# Service-account auth requires an explicit vault for `op item get` by name (op errors
|
|
69
|
+
# with "a vault query must be provided" otherwise) — the items live in the DevOps vault.
|
|
70
|
+
onepassword_vault: "DevOps"
|
|
71
|
+
onepassword_bitbucket_item: "Bitbucket API - jenkins@xsites.co.il"
|
|
72
|
+
onepassword_bitbucket_field: "credential"
|
|
73
|
+
onepassword_consul_item: "New_Consul_Token"
|
|
74
|
+
onepassword_consul_field: "password"
|
|
75
|
+
|
|
76
|
+
# --- Jira automation (DangerJS Fix Version gate) -------------------------------------
|
|
77
|
+
# The web-crm DangerJS pipeline FAILS any PR whose linked Jira issue has no Fix
|
|
78
|
+
# Version ("ATLP-XXXXX doesn't have a fix version") — develop feature branches included,
|
|
79
|
+
# not only hotfix→master. This step stamps the release Fix Version on
|
|
80
|
+
# jira_key_crm_branding BEFORE the branches are pushed (so the pipeline is green on its
|
|
81
|
+
# first run). Non-fatal: a missing jira_token / unmatched version just warns and skips.
|
|
82
|
+
manage_jira_fix_version: true
|
|
83
|
+
jira_base_url: "https://xsites.atlassian.net"
|
|
84
|
+
# Project key — defaults to the prefix of the Jira key (ATLP-47269 -> ATLP).
|
|
85
|
+
jira_project_key: "{{ (jira_key_crm_branding | default('')).split('-')[0] }}"
|
|
86
|
+
# Release version name = jira_version_prefix + <version/prod> (e.g. 27.0 -> V27.0).
|
|
87
|
+
jira_version_prefix: "V"
|
|
88
|
+
# Atlassian API token (ATATT) that carries JIRA scopes + the email that owns it (Basic
|
|
89
|
+
# auth). This is SEPARATE from bitbucket_token, which is Bitbucket-scoped only. Empty =>
|
|
90
|
+
# fetched from 1Password (onepassword_jira_* below). Override via --extra-vars in CI.
|
|
91
|
+
jira_token: ""
|
|
92
|
+
# NOTE: jira_email must own jira_token (Atlassian Basic auth = email:token). jenkins@xsites.co.il
|
|
93
|
+
# now has a Jira seat (2026-07-16) with BROWSE_PROJECTS + EDIT_ISSUES on ATLP; its token is a
|
|
94
|
+
# CLASSIC (unscoped) Atlassian API token stored in the DevOps note 'Jira API - jenkins@xsites.co.il'
|
|
95
|
+
# (field credential). Verified /myself 200 + fixVersions add. NB scoped tokens 401 on Jira REST —
|
|
96
|
+
# must be the classic unscoped kind. (eldadp personal my_attlasian_token still works as a fallback.)
|
|
97
|
+
jira_email: "jenkins@xsites.co.il"
|
|
98
|
+
onepassword_jira_item: "Jira API - jenkins@xsites.co.il"
|
|
99
|
+
onepassword_jira_field: "credential"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
galaxy_info:
|
|
3
|
+
role_name: onboard_crm
|
|
4
|
+
author: Antelope Systems
|
|
5
|
+
description: >-
|
|
6
|
+
Onboard a CRM brand: create the brand assets in web-crm
|
|
7
|
+
(via antelope-cli onboarding-crm) and open the pull request(s).
|
|
8
|
+
license: ISC
|
|
9
|
+
min_ansible_version: "2.12"
|
|
10
|
+
dependencies: []
|