@backstage/plugin-scaffolder-backend 1.22.0-next.2 → 1.22.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
+ ## 1.22.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e9663a9: Move away from using `ctx.logStream`
8
+ - aa543c9: Migrate plugin to use the new auth services, add an optional service discovery to the router options and change the permissions type to be `PermissionsService`.
9
+ - e9663a9: Enable the redaction of secrets using the redacting logger and the secrets from the `TaskSpec`
10
+ - c6b132e: Introducing checkpoints for scaffolder task action idempotency
11
+
12
+ ### Patch Changes
13
+
14
+ - 984abfa: Fixing the lost of the initial state after a task recovery.
15
+ - 703ebc9: Fix support for unauthenticated requests to create scaffolder tasks
16
+ - f44589d: Introduced `createMockActionContext` to unify the way of creating scaffolder mock context.
17
+
18
+ It will help to maintain tests in a long run during structural changes of action context.
19
+
20
+ - 0fb419b: Updated dependency `uuid` to `^9.0.0`.
21
+ Updated dependency `@types/uuid` to `^9.0.0`.
22
+ - bbd1fe1: Made "checkpoint" on scaffolder action context non-optional
23
+ - Updated dependencies
24
+ - @backstage/plugin-scaffolder-node@0.4.0
25
+ - @backstage/plugin-scaffolder-backend-module-azure@0.1.6
26
+ - @backstage/plugin-scaffolder-backend-module-bitbucket-cloud@0.1.4
27
+ - @backstage/plugin-scaffolder-backend-module-bitbucket-server@0.1.4
28
+ - @backstage/plugin-scaffolder-backend-module-bitbucket@0.2.4
29
+ - @backstage/backend-common@0.21.4
30
+ - @backstage/integration@1.9.1
31
+ - @backstage/plugin-auth-node@0.4.9
32
+ - @backstage/config@1.2.0
33
+ - @backstage/errors@1.2.4
34
+ - @backstage/backend-plugin-api@0.6.14
35
+ - @backstage/plugin-scaffolder-backend-module-gerrit@0.1.6
36
+ - @backstage/plugin-scaffolder-backend-module-github@0.2.4
37
+ - @backstage/plugin-scaffolder-backend-module-gitlab@0.3.0
38
+ - @backstage/plugin-scaffolder-backend-module-gitea@0.1.4
39
+ - @backstage/plugin-permission-common@0.7.13
40
+ - @backstage/plugin-catalog-node@1.8.0
41
+ - @backstage/catalog-client@1.6.1
42
+ - @backstage/backend-tasks@0.5.19
43
+ - @backstage/plugin-permission-node@0.7.25
44
+ - @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.1.11
45
+ - @backstage/catalog-model@1.4.5
46
+ - @backstage/types@1.1.1
47
+ - @backstage/plugin-scaffolder-common@1.5.1
48
+
3
49
  ## 1.22.0-next.2
4
50
 
5
51
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend",
3
- "version": "1.22.0-next.2",
3
+ "version": "1.22.0",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
package/dist/alpha.cjs.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var alpha = require('@backstage/plugin-scaffolder-common/alpha');
6
6
  var pluginPermissionNode = require('@backstage/plugin-permission-node');
7
- var router = require('./cjs/router-52d79583.cjs.js');
7
+ var router = require('./cjs/router-77345506.cjs.js');
8
8
  var backendPluginApi = require('@backstage/backend-plugin-api');
9
9
  var backendCommon = require('@backstage/backend-common');
10
10
  var integration = require('@backstage/integration');
@@ -1615,6 +1615,7 @@ class DatabaseTaskStore {
1615
1615
  try {
1616
1616
  const spec = JSON.parse(result.spec);
1617
1617
  const secrets = result.secrets ? JSON.parse(result.secrets) : void 0;
1618
+ const state = result.state ? JSON.parse(result.state).state : void 0;
1618
1619
  return {
1619
1620
  id: result.id,
1620
1621
  spec,
@@ -1622,7 +1623,8 @@ class DatabaseTaskStore {
1622
1623
  lastHeartbeatAt: parseSqlDateToIsoString(result.last_heartbeat_at),
1623
1624
  createdAt: parseSqlDateToIsoString(result.created_at),
1624
1625
  createdBy: (_a = result.created_by) != null ? _a : void 0,
1625
- secrets
1626
+ secrets,
1627
+ state
1626
1628
  };
1627
1629
  } catch (error) {
1628
1630
  throw new Error(`Failed to parse spec of task '${taskId}', ${error}`);
@@ -1659,6 +1661,15 @@ class DatabaseTaskStore {
1659
1661
  if (updateCount < 1) {
1660
1662
  return void 0;
1661
1663
  }
1664
+ const getState = () => {
1665
+ try {
1666
+ return task.state ? JSON.parse(task.state).state : void 0;
1667
+ } catch (error) {
1668
+ throw new Error(
1669
+ `Failed to parse state of the task '${task.id}', ${error}`
1670
+ );
1671
+ }
1672
+ };
1662
1673
  const secrets = this.parseTaskSecrets(task);
1663
1674
  return {
1664
1675
  id: task.id,
@@ -1667,7 +1678,8 @@ class DatabaseTaskStore {
1667
1678
  lastHeartbeatAt: task.last_heartbeat_at,
1668
1679
  createdAt: task.created_at,
1669
1680
  createdBy: (_a = task.created_by) != null ? _a : void 0,
1670
- secrets
1681
+ secrets,
1682
+ state: getState()
1671
1683
  };
1672
1684
  });
1673
1685
  }
@@ -1843,7 +1855,7 @@ class DatabaseTaskStore {
1843
1855
  taskIdsToRecover.push(...result.map((i) => i.id));
1844
1856
  for (const { id, spec } of result) {
1845
1857
  const taskSpec = JSON.parse(spec);
1846
- await this.db("task_events").insert({
1858
+ await tx("task_events").insert({
1847
1859
  task_id: id,
1848
1860
  event_type: "recovered",
1849
1861
  body: JSON.stringify({
@@ -2077,7 +2089,8 @@ class StorageTaskBroker {
2077
2089
  taskId: pendingTask.id,
2078
2090
  spec: pendingTask.spec,
2079
2091
  secrets: pendingTask.secrets,
2080
- createdBy: pendingTask.createdBy
2092
+ createdBy: pendingTask.createdBy,
2093
+ state: pendingTask.state
2081
2094
  },
2082
2095
  this.storage,
2083
2096
  abortController.signal,
@@ -3632,4 +3645,4 @@ exports.createRouter = createRouter;
3632
3645
  exports.createWaitAction = createWaitAction;
3633
3646
  exports.scaffolderActionRules = scaffolderActionRules;
3634
3647
  exports.scaffolderTemplateRules = scaffolderTemplateRules;
3635
- //# sourceMappingURL=router-52d79583.cjs.js.map
3648
+ //# sourceMappingURL=router-77345506.cjs.js.map