seqpulse 0.5.1 → 0.5.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.
- package/CI_CD_SNIPPETS_MULTI-PLATFORM.md +10 -10
- package/README.md +6 -6
- package/bin/seqpulse.js +5 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ Snippets de reference pour integrer `SeqPulse` avec la meme logique sur plusieur
|
|
|
6
6
|
2. deploy applicatif
|
|
7
7
|
3. `finish` toujours execute, meme en cas d'echec
|
|
8
8
|
|
|
9
|
-
Tous les snippets ci-dessous utilisent le package publie
|
|
9
|
+
Tous les snippets ci-dessous utilisent le package publie `seqpulse@0.5.1` et la sortie ciblee `--output deploymentId`.
|
|
10
10
|
|
|
11
11
|
## Variables requises
|
|
12
12
|
|
|
@@ -53,7 +53,7 @@ jobs:
|
|
|
53
53
|
- name: SeqPulse Trigger
|
|
54
54
|
id: seqpulse_trigger
|
|
55
55
|
run: |
|
|
56
|
-
DEPLOYMENT_ID="$(npx -y
|
|
56
|
+
DEPLOYMENT_ID="$(npx -y seqpulse@0.5.1 ci trigger \
|
|
57
57
|
--env prod \
|
|
58
58
|
--branch "${GITHUB_REF_NAME}" \
|
|
59
59
|
--non-blocking true \
|
|
@@ -66,7 +66,7 @@ jobs:
|
|
|
66
66
|
- name: SeqPulse Finish
|
|
67
67
|
if: ${{ always() }}
|
|
68
68
|
run: |
|
|
69
|
-
npx -y
|
|
69
|
+
npx -y seqpulse@0.5.1 ci finish \
|
|
70
70
|
--deployment-id "${{ steps.seqpulse_trigger.outputs.deployment_id }}" \
|
|
71
71
|
--job-status "${{ job.status }}" \
|
|
72
72
|
--non-blocking true
|
|
@@ -81,7 +81,7 @@ deploy_prod:
|
|
|
81
81
|
script:
|
|
82
82
|
- npm ci
|
|
83
83
|
- |
|
|
84
|
-
DEPLOYMENT_ID="$(npx -y
|
|
84
|
+
DEPLOYMENT_ID="$(npx -y seqpulse@0.5.1 ci trigger \
|
|
85
85
|
--env prod \
|
|
86
86
|
--branch "${CI_COMMIT_REF_NAME}" \
|
|
87
87
|
--non-blocking true \
|
|
@@ -91,7 +91,7 @@ deploy_prod:
|
|
|
91
91
|
after_script:
|
|
92
92
|
- . ./.seqpulse.env 2>/dev/null || true
|
|
93
93
|
- |
|
|
94
|
-
npx -y
|
|
94
|
+
npx -y seqpulse@0.5.1 ci finish \
|
|
95
95
|
--deployment-id "${SEQPULSE_DEPLOYMENT_ID}" \
|
|
96
96
|
--job-status "${CI_JOB_STATUS}" \
|
|
97
97
|
--non-blocking true
|
|
@@ -116,7 +116,7 @@ jobs:
|
|
|
116
116
|
- run:
|
|
117
117
|
name: SeqPulse Trigger
|
|
118
118
|
command: |
|
|
119
|
-
DEPLOYMENT_ID="$(npx -y
|
|
119
|
+
DEPLOYMENT_ID="$(npx -y seqpulse@0.5.1 ci trigger \
|
|
120
120
|
--env prod \
|
|
121
121
|
--branch "${CIRCLE_BRANCH}" \
|
|
122
122
|
--non-blocking true \
|
|
@@ -141,7 +141,7 @@ jobs:
|
|
|
141
141
|
when: always
|
|
142
142
|
command: |
|
|
143
143
|
. "$BASH_ENV"
|
|
144
|
-
npx -y
|
|
144
|
+
npx -y seqpulse@0.5.1 ci finish \
|
|
145
145
|
--deployment-id "${SEQPULSE_DEPLOYMENT_ID}" \
|
|
146
146
|
--job-status "${SEQPULSE_JOB_STATUS:-failed}" \
|
|
147
147
|
--non-blocking true
|
|
@@ -179,7 +179,7 @@ pipeline {
|
|
|
179
179
|
def branch = env.CHANGE_BRANCH ?: env.BRANCH_NAME ?: env.GIT_BRANCH ?: 'main'
|
|
180
180
|
env.SEQPULSE_DEPLOYMENT_ID = sh(
|
|
181
181
|
script: """
|
|
182
|
-
npx -y
|
|
182
|
+
npx -y seqpulse@0.5.1 ci trigger \
|
|
183
183
|
--env prod \
|
|
184
184
|
--branch "${branch}" \
|
|
185
185
|
--non-blocking true \
|
|
@@ -203,7 +203,7 @@ pipeline {
|
|
|
203
203
|
script {
|
|
204
204
|
def jobStatus = (currentBuild.currentResult ?: 'SUCCESS').toLowerCase()
|
|
205
205
|
sh """
|
|
206
|
-
npx -y
|
|
206
|
+
npx -y seqpulse@0.5.1 ci finish \
|
|
207
207
|
--deployment-id "${env.SEQPULSE_DEPLOYMENT_ID ?: ''}" \
|
|
208
208
|
--job-status "${jobStatus}" \
|
|
209
209
|
--non-blocking true
|
|
@@ -216,6 +216,6 @@ pipeline {
|
|
|
216
216
|
|
|
217
217
|
## Notes pratiques
|
|
218
218
|
|
|
219
|
-
- Si le package est deja installe dans le projet, vous pouvez remplacer `npx -y
|
|
219
|
+
- Si le package est deja installe dans le projet, vous pouvez remplacer `npx -y seqpulse@0.5.1` par `npx seqpulse`.
|
|
220
220
|
- Pour les deploys `prod`, ajoutez un gate explicite sur `main`/tag si votre pipeline est multi-branches.
|
|
221
221
|
- Le pattern recommande est toujours le meme: `trigger -> deploy -> finish`.
|
package/README.md
CHANGED
|
@@ -8,16 +8,16 @@ SeqPulse Node SDK couvre deux usages:
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
npm install
|
|
11
|
+
npm install seqpulse
|
|
12
12
|
# or
|
|
13
|
-
pnpm add
|
|
13
|
+
pnpm add seqpulse
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Runtime (Express)
|
|
17
17
|
|
|
18
18
|
```js
|
|
19
19
|
const express = require("express");
|
|
20
|
-
const seqpulse = require("
|
|
20
|
+
const seqpulse = require("seqpulse");
|
|
21
21
|
|
|
22
22
|
const app = express();
|
|
23
23
|
|
|
@@ -53,7 +53,7 @@ app.listen(3000, () => {
|
|
|
53
53
|
## CI/CD client (trigger/finish)
|
|
54
54
|
|
|
55
55
|
```js
|
|
56
|
-
const seqpulse = require("
|
|
56
|
+
const seqpulse = require("seqpulse");
|
|
57
57
|
|
|
58
58
|
const client = seqpulse.createCIClient({
|
|
59
59
|
baseUrl: process.env.SEQPULSE_BASE_URL,
|
|
@@ -85,12 +85,12 @@ async function runDeployment() {
|
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
87
|
# Trigger
|
|
88
|
-
DEPLOYMENT_ID="$(npx -y
|
|
88
|
+
DEPLOYMENT_ID="$(npx -y seqpulse@0.5.1 ci trigger \
|
|
89
89
|
--env prod \
|
|
90
90
|
--output deploymentId)"
|
|
91
91
|
|
|
92
92
|
# Finish
|
|
93
|
-
npx -y
|
|
93
|
+
npx -y seqpulse@0.5.1 ci finish \
|
|
94
94
|
--deployment-id "$DEPLOYMENT_ID" \
|
|
95
95
|
--job-status "$JOB_STATUS"
|
|
96
96
|
```
|
package/bin/seqpulse.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
const fs = require("node:fs");
|
|
5
5
|
const seqpulse = require("../index.js");
|
|
6
6
|
|
|
7
|
+
const BOOLEAN_FLAGS = new Set(["blocking", "help", "h"]);
|
|
8
|
+
|
|
7
9
|
function printUsage() {
|
|
8
10
|
console.error(`Usage:
|
|
9
11
|
seqpulse ci trigger [options]
|
|
@@ -57,6 +59,9 @@ function parseArgs(argv) {
|
|
|
57
59
|
const key = token.slice(2);
|
|
58
60
|
const next = argv[i + 1];
|
|
59
61
|
if (!next || next.startsWith("--")) {
|
|
62
|
+
if (!BOOLEAN_FLAGS.has(key)) {
|
|
63
|
+
throw new Error(`Option --${key} requires a value`);
|
|
64
|
+
}
|
|
60
65
|
options[key] = true;
|
|
61
66
|
continue;
|
|
62
67
|
}
|