antelope-cli 1.2.0 → 1.2.2

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.
@@ -1,72 +1,105 @@
1
- # Client Area brand onboarding (Ansible)
2
-
3
- Automates onboarding a new client brand into
4
- [`web-client-area`](https://bitbucket.org/xsitesinc/web-client-area): it creates the brand
5
- assets and opens the pull request(s), reproducing the manual onboarding PRs
6
- (e.g. [#4266](https://bitbucket.org/xsitesinc/web-client-area/pull-requests/4266)).
7
-
8
- Per brand it creates, under the target repo:
9
-
10
- - `src/assets/other/<folder>/<folder>.scss` — empty stylesheet
11
- - `src/assets/other/<folder>/legal/risk-disclaimer.html` — the standard disclaimer
12
-
13
- The file creation is delegated to the `onboarding-ca` command of the published
14
- [`antelope-cli`](https://www.npmjs.com/package/antelope-cli) (`npx antelope-cli@<version> onboarding-ca`);
15
- this role owns cloning, branching, committing, pushing and PR creation.
16
-
17
- ## Preconditions (control node)
18
-
19
- - `git`, Node.js (engines `^16.20.2`) and `npx` on `PATH`.
20
- - An **SSH key authorized to push** to `xsitesinc/web-client-area` (push is over SSH).
21
- - A **Bitbucket API token** with pull-request write access (used only for the REST calls:
22
- reviewer lookup + PR creation). Store it in Ansible Vault or pass via environment — never commit it.
23
- - `ansible.builtin.uri` needs Python `urllib` (standard). No extra collections required.
24
-
25
- ## Usage
26
-
27
- Interactive (prompts for the inputs):
28
-
29
- ```bash
30
- ansible-playbook onboard-ca.yml
31
- ```
32
-
33
- Non-interactive (for CI / wrapping playbooks) — extra-vars skip the prompts:
34
-
35
- ```bash
36
- ansible-playbook onboard-ca.yml \
37
- -e brand_name="Zenith Horizon Group" \
38
- -e jira_key=ATLP-47067 \
39
- -e dest_branches=develop,master-26.9 \
40
- -e bitbucket_token="$BITBUCKET_TOKEN"
41
- ```
42
-
43
- ## Inputs
44
-
45
- | var | required | example | notes |
46
- |-----|----------|---------|-------|
47
- | `brand_name` | yes | `Zenith Horizon Group` | display name → PR title |
48
- | `jira_key` | yes | `ATLP-47067` | PR title prefix + branch name |
49
- | `dest_branches` | yes | `develop,master-26.9` | comma-separated; **one PR per branch** |
50
- | `bitbucket_token` | yes | *(secret)* | Bearer token for the REST calls |
51
- | `brand_assets_folder` | no | `zenithhorizongroup` | folder name → CLI `--brand_assets_folder`, branch name; prompted separately. Blank ⇒ derived from `brand_name` (lowercased, spaces removed) |
52
- | `reviewers` | no | *(auto)* | default: repo's Bitbucket default-reviewers (author excluded); override with `[{account_id: "..."}]` |
53
- | `antelope_cli_version` | no | `1.2.0` | pinned published CLI version |
54
- | `work_dir` | no | `/tmp/onboard-ca/web-client-area` | clone location |
55
- | `git_user_name` / `git_user_email` | no | | commit identity |
56
-
57
- ## Behavior notes
58
-
59
- - **One PR per destination branch.** `develop` → `feature/<jira>-onboarding-<folder>`;
60
- `master-*`/`release-*` `hotfix/<jira>-onboarding-<folder>`. Each branch is based on its own
61
- destination so diverged histories don't bleed across PRs.
62
- - **Reviewers** are read from the repo's Bitbucket *Default reviewers* config; the authenticating
63
- account is excluded (Bitbucket rejects a PR whose author is a reviewer).
64
- - **Idempotent:** re-running with the same inputs recreates the (identical) files on the existing
65
- source branch, detects no staged changes, skips commit/push, and tolerates the "PR already exists"
66
- response (HTTP 400).
67
- - The playbook prints a summary of created PRs (destination, source branch, status, URL).
68
-
69
- ## Scope
70
-
71
- Client Area only. web-crm onboarding is a separate, independent process (its file edits live in
72
- antelope-cli's existing `onboarding` command) and is not run by this playbook.
1
+ # Client Area brand onboarding (Ansible)
2
+
3
+ Automates onboarding a new client brand into
4
+ [`web-client-area`](https://bitbucket.org/xsitesinc/web-client-area): it creates the brand
5
+ assets and opens the pull request(s), reproducing the manual onboarding PRs
6
+ (e.g. [#4266](https://bitbucket.org/xsitesinc/web-client-area/pull-requests/4266)).
7
+
8
+ Per brand it creates, under the target repo:
9
+
10
+ - `src/assets/other/<folder>/<folder>.scss` — empty stylesheet
11
+ - `src/assets/other/<folder>/legal/risk-disclaimer.html` — the standard disclaimer
12
+
13
+ The file creation is delegated to the `onboarding-ca` command of the published
14
+ [`antelope-cli`](https://www.npmjs.com/package/antelope-cli) (`npx antelope-cli@<version> onboarding-ca`);
15
+ this role owns cloning, branching, committing, pushing and PR creation.
16
+
17
+ ## Preconditions (control node)
18
+
19
+ - `git`, Node.js (engines `^16.20.2`) and `npx` on `PATH`.
20
+ - An **SSH key authorized to push** to `xsitesinc/web-client-area` (push is over SSH).
21
+ - An **Atlassian API token** (`ATATT…`) for the account in `bitbucket_email`, carrying Bitbucket
22
+ scopes `read:user`, `read:repository`, `read:pullrequest`, `write:pullrequest`. Used only for the
23
+ REST calls (reviewer lookup + PR creation) via **HTTP Basic auth** (`email:token`) these tokens
24
+ are **not** Bearer tokens. Create at <https://id.atlassian.com/manage-profile/security/api-tokens>.
25
+ Provide via `--extra-vars` / Ansible Vault, or leave it blank and let the playbook fetch it from
26
+ 1Password (item `jenkins@xsites.co.il`, field `bitbucket_scoped_token`).
27
+ - A **Consul token** with `read` scope on `version/*` (v2 cluster) — used to derive the destination
28
+ branches from the release train. Provide via `-e consul_token=…`, `$CONSUL_HTTP_TOKEN`, or leave it
29
+ blank and let the playbook fetch it from 1Password (item `New_Consul_Token`, field `password`).
30
+ Not needed when you pass an explicit `dest_branches` override.
31
+ - A **signed-in `op` CLI** (`op signin`, or `OP_SERVICE_ACCOUNT_TOKEN`) if you rely on the 1Password
32
+ fallbacks above instead of passing the tokens explicitly.
33
+ - The **`community.general`** collection (for the `dict_kv` filter): `ansible-galaxy collection install -r requirements.yml`.
34
+
35
+ ## Usage
36
+
37
+ Interactive (prompts for the inputs):
38
+
39
+ ```bash
40
+ ansible-playbook onboard-ca.yml
41
+ ```
42
+
43
+ Non-interactive (for CI / wrapping playbooks) — extra-vars skip the prompts. Destination
44
+ branches are derived from Consul, and both tokens fall back to 1Password, so the minimal run is:
45
+
46
+ ```bash
47
+ ansible-playbook onboard-ca.yml \
48
+ -e brand_name="Zenith Horizon Group" \
49
+ -e jira_key_client_branding=ATLP-47067
50
+ ```
51
+
52
+ Passing the tokens explicitly (skips the 1Password lookups) and pinning the branches:
53
+
54
+ ```bash
55
+ ansible-playbook onboard-ca.yml \
56
+ -e brand_name="Zenith Horizon Group" \
57
+ -e jira_key_client_branding=ATLP-47067 \
58
+ -e dest_branches=develop,master-26.9 \
59
+ -e consul_token="$CONSUL_HTTP_TOKEN" \
60
+ -e bitbucket_email=jenkins@xsites.co.il \
61
+ -e bitbucket_token="$BITBUCKET_TOKEN"
62
+ ```
63
+
64
+ Note: pass token values literally (or via a shell variable as above). Do **not** prefix a raw
65
+ `ATATT…` token with `$` the shell would try to expand it as a variable and send an empty token.
66
+
67
+ ## Inputs
68
+
69
+ | var | required | example | notes |
70
+ |-----|----------|---------|-------|
71
+ | `brand_name` | yes | `Zenith Horizon Group` | display name PR title |
72
+ | `jira_key_client_branding` | yes | `ATLP-47067` | PR title prefix + branch name |
73
+ | `bitbucket_token` | no* | *(secret)* | Atlassian API token (`ATATT…`) for the REST calls; sent via Basic auth. *Blank ⇒ fetched from 1Password (`jenkins@xsites.co.il` / `bitbucket_scoped_token`)* |
74
+ | `bitbucket_email` | yes | `jenkins@xsites.co.il` | account that owns the token (Basic-auth username); defaults to the Jenkins service account |
75
+ | `dest_branches` | no | `develop,master-26.9` | comma-separated override; **blank ⇒ derived from Consul** (see below). **One PR per branch** |
76
+ | `consul_token` | no* | *(secret)* | read scope on `version/*`. *Blank ⇒ `$CONSUL_HTTP_TOKEN`, else 1Password (`New_Consul_Token` / `password`)*. Unused when `dest_branches` is set |
77
+ | `brand_assets_folder` | no | `zenithhorizongroup` | folder name → CLI `--brand_assets_folder`, branch name; prompted separately. Blank ⇒ derived from `brand_name` (lowercased, spaces removed) |
78
+ | `reviewers` | no | *(auto)* | default: repo's Bitbucket default-reviewers (author excluded); override with `[{account_id: "..."}]` |
79
+ | `consul_url` | no | `https://consul.xsites.xyz` | Consul base URL for the version lookup |
80
+ | `onepassword_bitbucket_item` / `_field` | no | `jenkins@xsites.co.il` / `bitbucket_scoped_token` | 1Password source for the Bitbucket token |
81
+ | `onepassword_consul_item` / `_field` | no | `New_Consul_Token` / `password` | 1Password source for the Consul token |
82
+ | `antelope_cli_version` | no | `1.2.0` | pinned published CLI version |
83
+ | `work_dir` | no | `/tmp/onboard-ca/web-client-area` | clone location |
84
+ | `git_user_name` / `git_user_email` | no | | commit identity |
85
+
86
+ ## Behavior notes
87
+
88
+ - **Destination branches are derived from the release train in Consul** (unless `dest_branches`
89
+ is passed). `develop` is always onboarded; `master-<version/prod>` tracks the live release; and
90
+ while a new release is staged (`version/staging != version/prod`) its `master-<version/staging>`
91
+ is onboarded too. Once staging has shipped (`staging == prod`) there is a single master branch.
92
+ - **One PR per destination branch.** `develop` → `feature/<jira>-onboarding-<folder>`;
93
+ `master-*`/`release-*` → `hotfix/<jira>-onboarding-<folder>`. Each branch is based on its own
94
+ destination so diverged histories don't bleed across PRs.
95
+ - **Reviewers** are read from the repo's Bitbucket *Default reviewers* config; the authenticating
96
+ account is excluded (Bitbucket rejects a PR whose author is a reviewer).
97
+ - **Idempotent:** re-running with the same inputs recreates the (identical) files on the existing
98
+ source branch, detects no staged changes, skips commit/push, and tolerates the "PR already exists"
99
+ response (HTTP 400).
100
+ - The playbook prints a summary of created PRs (destination, source branch, status, URL).
101
+
102
+ ## Scope
103
+
104
+ Client Area only. web-crm onboarding is a separate, independent process (its file edits live in
105
+ antelope-cli's existing `onboarding` command) and is not run by this playbook.
@@ -1,41 +1,51 @@
1
- ---
2
- # Onboard a Client Area brand into web-client-area and open the PR(s).
3
- #
4
- # Interactive:
5
- # ansible-playbook onboard-ca.yml
6
- #
7
- # Non-interactive (e.g. from another playbook / CI), pass everything as extra-vars:
8
- # ansible-playbook onboard-ca.yml \
9
- # -e brand_name="Zenith Horizon Group" \
10
- # -e brand_assets_folder=zenithhorizongroup \
11
- # -e jira_key=ATLP-47067 \
12
- # -e dest_branches=develop,master-26.9 \
13
- # -e bitbucket_token="$BITBUCKET_TOKEN"
14
- #
15
- # Preconditions on the control node: git + Node (>=16) + npx, an SSH key authorized to
16
- # push to xsitesinc/web-client-area, and a Bitbucket API token with PR write access.
17
- - name: Onboard a Client Area brand (web-client-area)
18
- hosts: localhost
19
- connection: local
20
- gather_facts: false
21
-
22
- vars_prompt:
23
- - name: brand_name
24
- prompt: "Brand display name used in the PR title (e.g. Zenith Horizon Group)"
25
- private: false
26
- - name: brand_assets_folder
27
- prompt: "Brand assets folder name — the src/assets/other/<folder> (e.g. zenithhorizongroup); leave blank to derive from the display name"
28
- default: ""
29
- private: false
30
- - name: jira_key
31
- prompt: "Jira key (e.g. ATLP-47067)"
32
- private: false
33
- - name: dest_branches
34
- prompt: "Destination branches, comma-separated (e.g. develop,master-26.9)"
35
- private: false
36
- - name: bitbucket_token
37
- prompt: "Bitbucket API token"
38
- private: true
39
-
40
- roles:
41
- - onboard_ca
1
+ ---
2
+ # Onboard a Client Area brand into web-client-area 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-ca.yml
11
+ #
12
+ # Non-interactive (e.g. from another playbook / CI), pass everything as extra-vars:
13
+ # ansible-playbook onboard-ca.yml \
14
+ # -e brand_name="Eldadtestbrand" \
15
+ # -e brand_assets_folder=eldadtestbrand \
16
+ # -e jira_key_client_branding=ATLP-47067 \
17
+ # -e consul_token="$CONSUL_HTTP_TOKEN" \ # read scope on version/*; used to derive dest branches
18
+ # -e bitbucket_email=jenkins@xsites.co.il \
19
+ # -e bitbucket_token=ATATT3x... # Atlassian API token WITHOUT a leading '$' (it is a literal, not a shell var)
20
+
21
+ # Preconditions on the control node: git + Node (>=16) + npx, an SSH key authorized to
22
+ # push to xsitesinc/web-client-area, and an Atlassian API token (ATATT…) owned by
23
+ # bitbucket_email, carrying Bitbucket scopes read:user / read:repository /
24
+ # read+write:pullrequest. The token is used via HTTP Basic auth (email:token).
25
+ - name: Onboard a Client Area brand (web-client-area)
26
+ hosts: localhost
27
+ connection: local
28
+ gather_facts: false
29
+
30
+ vars_prompt:
31
+ - name: brand_name
32
+ prompt: "Brand display name — used in the PR title (e.g. Zenith Horizon Group)"
33
+ private: false
34
+ - name: brand_assets_folder
35
+ prompt: "Brand assets folder name — the src/assets/other/<folder> (e.g. zenithhorizongroup); leave blank to derive from the display name"
36
+ default: ""
37
+ private: false
38
+ - name: jira_key_client_branding
39
+ prompt: "Jira key (e.g. ATLP-47067)"
40
+ private: false
41
+ - name: bitbucket_email
42
+ prompt: "Atlassian account email that owns the API token (Basic-auth username)"
43
+ default: "jenkins@xsites.co.il"
44
+ private: false
45
+ - name: bitbucket_token
46
+ prompt: "Atlassian API token (ATATT…); leave blank to fetch from 1Password (item jenkins@xsites.co.il)"
47
+ default: ""
48
+ private: true
49
+
50
+ roles:
51
+ - onboard_ca
@@ -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"
@@ -1,24 +1,49 @@
1
- ---
2
- # Pinned published antelope-cli version that provides the `onboarding-ca` command.
3
- antelope_cli_version: "1.2.0"
4
-
5
- # Where web-client-area is cloned on the control node.
6
- work_dir: "/tmp/onboard-ca/web-client-area"
7
-
8
- # Brand assets folder name (used for ENV_branding.brand_assets_folder and the src/assets/other/<folder>).
9
- # Empty => derived from brand_name (lowercased, spaces removed), matching antelope-cli's
10
- # connectedBrandName so the folder name is identical across repos.
11
- brand_assets_folder: ""
12
-
13
- # Reviewers for the PR. Empty => auto-fetched from the repo's Bitbucket "Default reviewers"
14
- # config (the authenticating account is excluded automatically). Override with an explicit
15
- # list, e.g. [{ account_id: "..." }] or [{ uuid: "{...}" }], to bypass the lookup.
16
- reviewers: []
17
-
18
- # Identity used for the commit (control-node git may have no global config).
19
- git_user_name: "Antelope Onboarding Bot"
20
- git_user_email: "devops@antelopesystem.com"
21
-
22
- # Bitbucket API token (Bearer) for the reviewer lookup + PR creation.
23
- # Provide via --extra-vars or Ansible Vault; never commit a real value.
24
- bitbucket_token: ""
1
+ ---
2
+ # Pinned published antelope-cli version that provides the `onboarding-ca` command.
3
+ antelope_cli_version: "1.2.0"
4
+
5
+ # Where web-client-area is cloned on the control node.
6
+ work_dir: "/tmp/onboard-ca/web-client-area"
7
+
8
+ # Brand assets folder name (used for ENV_branding.brand_assets_folder and the src/assets/other/<folder>).
9
+ # Empty => derived from brand_name (lowercased, spaces removed), matching antelope-cli's
10
+ # connectedBrandName so the folder name is identical across repos.
11
+ brand_assets_folder: ""
12
+
13
+ # Reviewers for the PR. Empty => auto-fetched from the repo's Bitbucket "Default reviewers"
14
+ # config (the authenticating account is excluded automatically). Override with an explicit
15
+ # list, e.g. [{ account_id: "..." }] or [{ uuid: "{...}" }], to bypass the lookup.
16
+ reviewers: []
17
+
18
+ # Identity used for the commit (control-node git may have no global config).
19
+ git_user_name: "Jenkins"
20
+ git_user_email: "jenkins@xsites.co.il"
21
+
22
+ # Atlassian API token (ATATT…) for the reviewer lookup + PR creation. Sent via HTTP
23
+ # Basic auth together with bitbucket_email these tokens are NOT Bearer tokens and
24
+ # must carry Bitbucket scopes (read:user, read:repository, read/write:pullrequest).
25
+ # Empty => fetched from 1Password (see onepassword_bitbucket_* below). Provide via
26
+ # --extra-vars or Ansible Vault to skip the lookup; never commit a real value.
27
+ bitbucket_token: ""
28
+
29
+ # Email of the Atlassian account that owns bitbucket_token (the Basic-auth username).
30
+ # Defaults to the Jenkins service account; override via --extra-vars for a different account.
31
+ bitbucket_email: "jenkins@xsites.co.il"
32
+
33
+ # Consul token with read scope on version/* (v2 cluster). Used to derive the destination
34
+ # branches from the release train (version/prod, version/staging). Empty => resolved from
35
+ # $CONSUL_HTTP_TOKEN, else from 1Password (see onepassword_consul_* below). Not needed when
36
+ # an explicit dest_branches override is passed. Never commit a real value.
37
+ consul_token: ""
38
+
39
+ # Explicit destination-branch override (comma-separated). Empty => derived from Consul:
40
+ # develop + master-<version/prod> [+ master-<version/staging> while a release is staged].
41
+ # Set this to bypass the Consul lookup entirely, e.g. dest_branches=develop,master-26.9.
42
+ dest_branches: ""
43
+
44
+ # 1Password fallbacks — used only when the corresponding token is not otherwise provided.
45
+ # Require a signed-in `op` CLI on the control node (op signin, or OP_SERVICE_ACCOUNT_TOKEN).
46
+ onepassword_bitbucket_item: "jenkins@xsites.co.il"
47
+ onepassword_bitbucket_field: "bitbucket_scoped_token"
48
+ onepassword_consul_item: "New_Consul_Token"
49
+ onepassword_consul_field: "password"
@@ -1,10 +1,10 @@
1
- ---
2
- galaxy_info:
3
- role_name: onboard_ca
4
- author: Antelope Systems
5
- description: >-
6
- Onboard a Client Area brand: create the brand assets in web-client-area
7
- (via antelope-cli onboarding-ca) and open the pull request(s).
8
- license: ISC
9
- min_ansible_version: "2.12"
10
- dependencies: []
1
+ ---
2
+ galaxy_info:
3
+ role_name: onboard_ca
4
+ author: Antelope Systems
5
+ description: >-
6
+ Onboard a Client Area brand: create the brand assets in web-client-area
7
+ (via antelope-cli onboarding-ca) and open the pull request(s).
8
+ license: ISC
9
+ min_ansible_version: "2.12"
10
+ dependencies: []