@signageos/cli 4.0.0 → 4.0.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.
|
@@ -10,7 +10,7 @@ exports.getAuth0Settings = getAuth0Settings;
|
|
|
10
10
|
function getAuth0Settings() {
|
|
11
11
|
var _a, _b, _c, _d;
|
|
12
12
|
return {
|
|
13
|
-
domain: (_a = process.env.SOS_AUTH0_DOMAIN) !== null && _a !== void 0 ? _a : '
|
|
13
|
+
domain: (_a = process.env.SOS_AUTH0_DOMAIN) !== null && _a !== void 0 ? _a : 'auth0.signageos.io',
|
|
14
14
|
clientId: (_b = process.env.SOS_AUTH0_CLIENT_ID) !== null && _b !== void 0 ? _b : '8AU8D3zJ4mK8gszZP3gZO0nv9DusSNjV',
|
|
15
15
|
audience: (_c = process.env.SOS_AUTH0_AUDIENCE) !== null && _c !== void 0 ? _c : 'https://sos-production.us.auth0.com/api/v2/',
|
|
16
16
|
scope: (_d = process.env.SOS_AUTH0_SCOPE) !== null && _d !== void 0 ? _d : 'openid profile email offline_access',
|
package/dist/helper.js
CHANGED
|
@@ -68,6 +68,7 @@ function createOrganizationRestApi(credentials) {
|
|
|
68
68
|
auth,
|
|
69
69
|
version: apiVersions_1.ApiVersions.V1,
|
|
70
70
|
clientVersions: createClientVersions(),
|
|
71
|
+
organizationUid: config.defaultOrganizationUid,
|
|
71
72
|
};
|
|
72
73
|
const accountOptions = Object.assign({}, options);
|
|
73
74
|
return new RestApi_1.default(options, accountOptions);
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: ci-cd-setup
|
|
3
|
+
title: CI/CD Pipeline Setup
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
---
|
|
6
|
+
# CI/CD Pipeline Setup
|
|
7
|
+
|
|
8
|
+
How to configure the signageOS CLI for automated pipelines (GitLab CI, GitHub Actions, and other CI/CD tools) where interactive login is not possible.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
On a **local development machine**, you authenticate by running `sos login`, which interactively prompts for your username and password, generates a personal API security token, and stores it in `~/.sosrc`.
|
|
13
|
+
|
|
14
|
+
In a **CI/CD pipeline**, there is no interactive terminal. Instead, you generate a long-lived API security token ahead of time and provide it to the pipeline via the `~/.sosrc` configuration file or environment variables.
|
|
15
|
+
|
|
16
|
+
## Step 1: Generate an API Security Token
|
|
17
|
+
|
|
18
|
+
Before configuring your pipeline, generate a personal API security token:
|
|
19
|
+
|
|
20
|
+
1. Log in to [signageOS Box](https://box.signageos.io)
|
|
21
|
+
2. Navigate to **Settings** → **Profile** → **API Tokens**
|
|
22
|
+
3. Create a new token (account-wide or organization-scoped, depending on your needs)
|
|
23
|
+
4. Copy the **Token ID** (identification) and **Token secret** values — you will need both
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Step 2: Configure Authentication
|
|
27
|
+
|
|
28
|
+
You have two options — choose whichever fits your pipeline best.
|
|
29
|
+
|
|
30
|
+
### Option A: Configuration File (`~/.sosrc`)
|
|
31
|
+
|
|
32
|
+
Create the `~/.sosrc` file in the CI runner's home directory with your credentials in INI format:
|
|
33
|
+
|
|
34
|
+
```ini
|
|
35
|
+
apiUrl=https://api.signageos.io
|
|
36
|
+
identification=527f75f50ce2f3cxxxxx
|
|
37
|
+
apiSecurityToken=7dc58dc275c87283cddf78bc41755cb5f7fxxxxx
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The file supports the following fields:
|
|
41
|
+
|
|
42
|
+
| Field | Required | Description |
|
|
43
|
+
|-------|----------|-------------|
|
|
44
|
+
| `apiUrl` | Yes | signageOS API endpoint (typically `https://api.signageos.io`) |
|
|
45
|
+
| `identification` | Yes | Token ID from your security token |
|
|
46
|
+
| `apiSecurityToken` | Yes | The security token secret |
|
|
47
|
+
| `defaultOrganizationUid` | No | Default organization UID for commands that require one |
|
|
48
|
+
|
|
49
|
+
> **Security:** The CLI writes this file with permissions `0600` (owner read/write only). Make sure your pipeline step preserves these permissions.
|
|
50
|
+
|
|
51
|
+
### Option B: Environment Variables
|
|
52
|
+
|
|
53
|
+
Instead of writing a file, you can set environment variables that override `~/.sosrc` values:
|
|
54
|
+
|
|
55
|
+
| Environment Variable | Overrides |
|
|
56
|
+
|---------------------|-----------|
|
|
57
|
+
| `SOS_API_URL` | `apiUrl` |
|
|
58
|
+
| `SOS_API_IDENTIFICATION` | `identification` |
|
|
59
|
+
| `SOS_API_SECURITY_TOKEN` | `apiSecurityToken` |
|
|
60
|
+
| `SOS_ORGANIZATION_UID` | `defaultOrganizationUid` |
|
|
61
|
+
|
|
62
|
+
Environment variables take precedence over the configuration file, so you can combine both approaches (e.g., a base `.sosrc` with env var overrides for specific jobs).
|
|
63
|
+
|
|
64
|
+
## Pipeline Examples
|
|
65
|
+
|
|
66
|
+
### GitLab CI
|
|
67
|
+
|
|
68
|
+
Store your credentials as [CI/CD variables](https://docs.gitlab.com/ee/ci/variables/) in your project or group settings (masked and protected).
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
# .gitlab-ci.yml
|
|
72
|
+
|
|
73
|
+
variables:
|
|
74
|
+
SOS_API_URL: "https://api.signageos.io"
|
|
75
|
+
|
|
76
|
+
stages:
|
|
77
|
+
- deploy
|
|
78
|
+
|
|
79
|
+
deploy-applet:
|
|
80
|
+
stage: deploy
|
|
81
|
+
image: node:20
|
|
82
|
+
before_script:
|
|
83
|
+
- npm install -g @signageos/cli
|
|
84
|
+
# Write ~/.sosrc from CI/CD variables
|
|
85
|
+
- |
|
|
86
|
+
cat > ~/.sosrc <<EOF
|
|
87
|
+
apiUrl=${SOS_API_URL}
|
|
88
|
+
identification=${SOS_API_IDENTIFICATION}
|
|
89
|
+
apiSecurityToken=${SOS_API_SECURITY_TOKEN}
|
|
90
|
+
EOF
|
|
91
|
+
- chmod 600 ~/.sosrc
|
|
92
|
+
script:
|
|
93
|
+
- sos applet upload
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Alternatively, using only environment variables (no file needed):
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
deploy-applet:
|
|
100
|
+
stage: deploy
|
|
101
|
+
image: node:20
|
|
102
|
+
variables:
|
|
103
|
+
SOS_API_URL: "https://api.signageos.io"
|
|
104
|
+
# SOS_API_IDENTIFICATION and SOS_API_SECURITY_TOKEN come from CI/CD settings
|
|
105
|
+
before_script:
|
|
106
|
+
- npm install -g @signageos/cli
|
|
107
|
+
script:
|
|
108
|
+
- sos applet upload
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### GitHub Actions
|
|
112
|
+
|
|
113
|
+
Store your credentials as [repository secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets).
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
# .github/workflows/deploy.yml
|
|
117
|
+
|
|
118
|
+
name: Deploy Applet
|
|
119
|
+
|
|
120
|
+
on:
|
|
121
|
+
push:
|
|
122
|
+
branches: [main]
|
|
123
|
+
|
|
124
|
+
jobs:
|
|
125
|
+
deploy:
|
|
126
|
+
runs-on: ubuntu-latest
|
|
127
|
+
steps:
|
|
128
|
+
- uses: actions/checkout@v4
|
|
129
|
+
|
|
130
|
+
- uses: actions/setup-node@v4
|
|
131
|
+
with:
|
|
132
|
+
node-version: 20
|
|
133
|
+
|
|
134
|
+
- name: Install signageOS CLI
|
|
135
|
+
run: npm install -g @signageos/cli
|
|
136
|
+
|
|
137
|
+
- name: Configure signageOS credentials
|
|
138
|
+
run: |
|
|
139
|
+
cat > ~/.sosrc <<EOF
|
|
140
|
+
apiUrl=https://api.signageos.io
|
|
141
|
+
identification=${{ secrets.SOS_API_IDENTIFICATION }}
|
|
142
|
+
apiSecurityToken=${{ secrets.SOS_API_SECURITY_TOKEN }}
|
|
143
|
+
EOF
|
|
144
|
+
chmod 600 ~/.sosrc
|
|
145
|
+
|
|
146
|
+
- name: Deploy applet
|
|
147
|
+
run: sos applet upload
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Or using environment variables:
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
- name: Deploy applet
|
|
154
|
+
env:
|
|
155
|
+
SOS_API_URL: "https://api.signageos.io"
|
|
156
|
+
SOS_API_IDENTIFICATION: ${{ secrets.SOS_API_IDENTIFICATION }}
|
|
157
|
+
SOS_API_SECURITY_TOKEN: ${{ secrets.SOS_API_SECURITY_TOKEN }}
|
|
158
|
+
run: sos applet upload
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Using Profiles in CI/CD
|
|
162
|
+
|
|
163
|
+
If your pipeline needs to operate against multiple signageOS environments (e.g., staging and production), use profiles (see [`sos login`](/cli/login/) documentation):
|
|
164
|
+
|
|
165
|
+
```ini
|
|
166
|
+
[profile staging]
|
|
167
|
+
apiUrl=https://api.staging.signageos.io
|
|
168
|
+
identification=xxxxxxxxxxxxxxxxxxxx
|
|
169
|
+
apiSecurityToken=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
170
|
+
|
|
171
|
+
[profile production]
|
|
172
|
+
apiUrl=https://api.signageos.io
|
|
173
|
+
identification=yyyyyyyyyyyyyyyyyyyy
|
|
174
|
+
apiSecurityToken=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Then target a specific profile per job:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Deploy to staging
|
|
181
|
+
sos --profile staging applet upload
|
|
182
|
+
|
|
183
|
+
# Deploy to production
|
|
184
|
+
sos --profile production applet upload
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
You can also select a profile via the `SOS_PROFILE` environment variable:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
export SOS_PROFILE=production
|
|
191
|
+
sos applet upload
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Setting a Default Organization
|
|
195
|
+
|
|
196
|
+
Some CLI commands operate on a specific organization. To avoid interactive prompts in CI/CD, set the default organization:
|
|
197
|
+
|
|
198
|
+
**In `~/.sosrc`:**
|
|
199
|
+
```ini
|
|
200
|
+
apiUrl=https://api.signageos.io
|
|
201
|
+
identification=527f75f50ce2f3cxxxxx
|
|
202
|
+
apiSecurityToken=7dc58dc275c87283cddf78bc41755cb5f7fxxxxx
|
|
203
|
+
defaultOrganizationUid=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Or via environment variable:**
|
|
207
|
+
```bash
|
|
208
|
+
export SOS_ORGANIZATION_UID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Troubleshooting
|
|
212
|
+
|
|
213
|
+
### "Identification or token is missing"
|
|
214
|
+
|
|
215
|
+
The CLI cannot find valid credentials. Verify that:
|
|
216
|
+
- The `~/.sosrc` file exists and contains both `identification` and `apiSecurityToken`
|
|
217
|
+
- Or the `SOS_API_IDENTIFICATION` and `SOS_API_SECURITY_TOKEN` environment variables are set
|
|
218
|
+
- The token has not expired or been revoked
|
|
219
|
+
|
|
220
|
+
### "No API URL is defined"
|
|
221
|
+
|
|
222
|
+
The CLI needs an API URL. Ensure either:
|
|
223
|
+
- `apiUrl` is set in `~/.sosrc`
|
|
224
|
+
- Or `SOS_API_URL` environment variable is defined
|
|
225
|
+
|
|
226
|
+
### "Your authentication token is outdated"
|
|
227
|
+
|
|
228
|
+
The `identification` value does not match the expected format (20-character hex string). Regenerate the token via [signageOS Box](https://box.signageos.io/settings) or re-run `sos login` on your local machine and copy the new values.
|
|
229
|
+
|
|
230
|
+
## Security Best Practices
|
|
231
|
+
|
|
232
|
+
- **Never commit credentials** to your repository. Use CI/CD secret variables or a secrets manager.
|
|
233
|
+
- **Use masked variables** in GitLab CI / GitHub Actions so tokens don't appear in job logs.
|
|
234
|
+
- **Scope tokens appropriately** — prefer organization-scoped tokens when your pipeline only needs access to a single organization.
|
|
235
|
+
- **Rotate tokens periodically** and revoke unused ones via signageOS Box settings.
|
|
236
|
+
|
|
237
|
+
## See Also
|
|
238
|
+
|
|
239
|
+
- [`sos login`](/cli/login/) — Interactive authentication for local development
|
|
240
|
+
- [Global Options](/cli/) — `--profile` and `--api-url` flags
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signageos/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"author": "signageOS.io <dev@signageos.io>",
|
|
6
6
|
"files": [
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@signageos/cli-common": "0.1.0",
|
|
89
89
|
"@signageos/file": "2.0.1",
|
|
90
|
-
"@signageos/sdk": "2.6.
|
|
90
|
+
"@signageos/sdk": "2.6.1",
|
|
91
91
|
"archiver": "7.0.1",
|
|
92
92
|
"chalk": "2.4.2",
|
|
93
93
|
"child-process-promise": "2.1.3",
|