@pipeline-builder/api-core 7.4.2 → 7.4.3

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.
@@ -43,13 +43,13 @@ export type TerminalRunRequestStatus = (typeof TERMINAL_RUN_REQUEST_STATUSES)[nu
43
43
  /** Whether `s` is a terminal request status (false for anything unknown). */
44
44
  export declare function isTerminalRunRequestStatus(s: unknown): s is TerminalRunRequestStatus;
45
45
  /** What a signed request asks the runner to do. */
46
- export declare const RUNNER_ACTIONS: readonly ['start', 'stop', 'probe', 'ping', 'status', 'deploy', 'deploy_status', 'deploy_cancel', 'undeploy'];
46
+ export declare const RUNNER_ACTIONS: readonly ['start', 'stop', 'probe', 'ping', 'status', 'deploy', 'deploy_status', 'deploy_cancel', 'undeploy', 'list_sources', 'check_source'];
47
47
  export type RunnerAction = (typeof RUNNER_ACTIONS)[number];
48
- /** The actions recorded as a run request row (a `ping`, a `status` / `deploy_status` read and a `deploy_cancel` never are). */
48
+ /** The actions recorded as a run request row (a `ping`, a `status` / `deploy_status` read, a `deploy_cancel` and the source actions never are). */
49
49
  export declare const RUN_REQUEST_ACTIONS: readonly ["start", "stop", "probe", "deploy", "undeploy"];
50
50
  export type RunRequestAction = (typeof RUN_REQUEST_ACTIONS)[number];
51
51
  /** A runner's successful answers (`outcome` of a 200). */
52
- export declare const RUNNER_OUTCOMES: readonly ['started', 'stopped', 'match', 'no_match', 'pong', 'status', 'deploying', 'deploy_status', 'deploy_cancelled', 'undeploying'];
52
+ export declare const RUNNER_OUTCOMES: readonly ['started', 'stopped', 'match', 'no_match', 'pong', 'status', 'deploying', 'deploy_status', 'deploy_cancelled', 'undeploying', 'sources', 'source_ok'];
53
53
  export type RunnerOutcome = (typeof RUNNER_OUTCOMES)[number];
54
54
  /** The outcome a successful answer to each action must carry. */
55
55
  export declare const EXPECTED_OUTCOMES: Readonly<Record<RunnerAction, readonly RunnerOutcome[]>>;
@@ -58,10 +58,14 @@ export declare const EXPECTED_OUTCOMES: Readonly<Record<RunnerAction, readonly R
58
58
  * the stack was set up with `--enable-deploy` (EnableDeploy=true) and the
59
59
  * bundle speaks deploy, deploy_status, deploy_cancel and undeploy. One
60
60
  * capability covers undeploy too: it runs the same CodeBuild project.
61
+ * `sources:1`: the bundle speaks list_sources and check_source and its role may
62
+ * list the account's CodeConnections connections and describe its GitHub token
63
+ * secrets — every bundle from this version on, with or without deploys.
61
64
  */
62
- export declare const RUNNER_CAPABILITIES: readonly ['deploy:1'];
65
+ export declare const RUNNER_CAPABILITIES: readonly ['deploy:1', 'sources:1'];
63
66
  export type RunnerCapability = (typeof RUNNER_CAPABILITIES)[number];
64
67
  export declare const DEPLOY_CAPABILITY: "deploy:1";
68
+ export declare const SOURCES_CAPABILITY: "sources:1";
65
69
  /**
66
70
  * The capability each gated action needs. The platform checks it BEFORE
67
71
  * signing: a bundle without it answers an unknown action 401
@@ -73,6 +77,11 @@ export declare const DEPLOY_ACTION_CAPABILITY: {
73
77
  readonly deploy_cancel: "deploy:1";
74
78
  readonly undeploy: "deploy:1";
75
79
  };
80
+ /** The source actions' capability (checked before signing, like the deploy actions'). */
81
+ export declare const SOURCE_ACTION_CAPABILITY: {
82
+ readonly list_sources: "sources:1";
83
+ readonly check_source: "sources:1";
84
+ };
76
85
  /** Whether a runner reporting `capabilities` may be sent `action`. */
77
86
  export declare function runnerSupportsAction(capabilities: readonly string[], action: RunnerAction): boolean;
78
87
  /** A pong's `capabilities`, kept to the known ones (deduplicated, catalog order); [] for anything malformed. */
@@ -482,6 +491,48 @@ export declare const RUNNER_ERRORS: {
482
491
  readonly retryable: false;
483
492
  readonly category: 'runner';
484
493
  };
494
+ /** The region asked about is not one of the runner's allowed regions. */
495
+ readonly SOURCE_REGION_NOT_ALLOWED: {
496
+ readonly httpStatus: 403;
497
+ readonly retryable: false;
498
+ readonly category: 'runner';
499
+ };
500
+ /** No such CodeConnections connection in the account. */
501
+ readonly SOURCE_CONNECTION_NOT_FOUND: {
502
+ readonly httpStatus: 404;
503
+ readonly retryable: false;
504
+ readonly category: 'runner';
505
+ };
506
+ /** The connection exists but is not AVAILABLE (its handshake is pending, or it is in error). */
507
+ readonly SOURCE_CONNECTION_NOT_AVAILABLE: {
508
+ readonly httpStatus: 409;
509
+ readonly retryable: false;
510
+ readonly category: 'runner';
511
+ };
512
+ /** The connection ARN names another AWS account than the runner's. */
513
+ readonly SOURCE_CONNECTION_WRONG_ACCOUNT: {
514
+ readonly httpStatus: 409;
515
+ readonly retryable: false;
516
+ readonly category: 'runner';
517
+ };
518
+ /** The connection ARN names another region than the deploy's. */
519
+ readonly SOURCE_CONNECTION_WRONG_REGION: {
520
+ readonly httpStatus: 409;
521
+ readonly retryable: false;
522
+ readonly category: 'runner';
523
+ };
524
+ /** The connection is for another Git provider or server than the repository's host. */
525
+ readonly SOURCE_CONNECTION_WRONG_PROVIDER: {
526
+ readonly httpStatus: 409;
527
+ readonly retryable: false;
528
+ readonly category: 'runner';
529
+ };
530
+ /** A token-less GitHub source, and neither the owner's nor the org's GitHub token secret exists in the region. */
531
+ readonly GITHUB_TOKEN_MISSING: {
532
+ readonly httpStatus: 409;
533
+ readonly retryable: false;
534
+ readonly category: 'runner';
535
+ };
485
536
  /** Not delivered within the request's lifetime. */
486
537
  readonly RUN_REQUEST_EXPIRED: {
487
538
  readonly httpStatus: null;
@@ -578,6 +629,8 @@ export interface RunClaims {
578
629
  deployRequestId?: string;
579
630
  /** deploy_status and deploy_cancel only: the build the runner answered `deploying` / `undeploying` with. */
580
631
  buildId?: string;
632
+ /** list_sources and check_source only. */
633
+ sources?: RunSourcesClaim;
581
634
  requestedBy: string;
582
635
  }
583
636
  /**
@@ -606,6 +659,51 @@ export interface RunDeployClaim {
606
659
  /** The managed toolchain release that image belongs to. */
607
660
  toolchainRelease: string;
608
661
  }
662
+ /**
663
+ * The `sources` claim block (actions `list_sources` and `check_source`). The
664
+ * runner's stack does not know which org it serves (a runner may be shared with
665
+ * sub-organizations), so the platform names the asking org: the runner looks up
666
+ * that org's GitHub token secrets only. `region` must be one of the runner's
667
+ * allowed regions. Every field is checked by the runner before any AWS call.
668
+ */
669
+ export interface RunSourcesClaim {
670
+ /** The org asking (whose `<prefix>/<orgId>/github-token[/<owner>]` secrets are looked up). */
671
+ orgId: string;
672
+ /** The region the pipeline deploys to (connections are regional). */
673
+ region: string;
674
+ /**
675
+ * The repository: its host (lowercased) and owner (first path segment).
676
+ * Required everywhere but on check_source of a codestar connection: a saved
677
+ * pipeline's codestar source records no host, so the deploy pre-check sends
678
+ * none and the runner skips the provider match (existence, status, account
679
+ * and region are still checked).
680
+ */
681
+ repository?: {
682
+ host: string;
683
+ owner: string;
684
+ };
685
+ /** check_source only: the source the pipeline uses. */
686
+ source?: RunSourceCheck;
687
+ }
688
+ /** What check_source checks: a CodeConnections connection, or a token-less GitHub source's token secret. */
689
+ export type RunSourceCheck = {
690
+ type: 'codestar';
691
+ connectionArn: string;
692
+ } | {
693
+ type: 'github';
694
+ };
695
+ /** An org id as the platform signs it (a Mongo ObjectId or the system org's id): what may name a secret path segment. */
696
+ export declare const SOURCE_ORG_ID_PATTERN: RegExp;
697
+ /** A repository host (DNS name, lowercase). */
698
+ export declare const SOURCE_HOST_PATTERN: RegExp;
699
+ /** A repository owner / group segment. */
700
+ export declare const SOURCE_OWNER_PATTERN: RegExp;
701
+ /** check_source's refusals (a runner 4xx `errorCode`), in the order the runner checks them. */
702
+ export declare const SOURCE_CHECK_REFUSALS: readonly ["SOURCE_REGION_NOT_ALLOWED", "SOURCE_CONNECTION_NOT_FOUND", "SOURCE_CONNECTION_NOT_AVAILABLE", "SOURCE_CONNECTION_WRONG_ACCOUNT", "SOURCE_CONNECTION_WRONG_REGION", "SOURCE_CONNECTION_WRONG_PROVIDER", "GITHUB_TOKEN_MISSING"];
703
+ export type SourceCheckRefusal = (typeof SOURCE_CHECK_REFUSALS)[number];
704
+ /** Why the source options could not be listed (the picker falls back to pasting an ARN and says why). */
705
+ export declare const SOURCE_OPTIONS_UNAVAILABLE_REASONS: readonly ['no_runner', 'runner_update_required', 'runner_unreachable', 'team_deploys_not_shared', 'rate_limited'];
706
+ export type SourceOptionsUnavailableReason = (typeof SOURCE_OPTIONS_UNAVAILABLE_REASONS)[number];
609
707
  /**
610
708
  * A signing key's lifecycle (`pipeline_runner_signing_keys.state`):
611
709
  * - `next` — published in the JWKS, not signing yet (signs from `activates_at`);
@@ -697,7 +795,9 @@ export declare const UNREACHABLE_AFTER_FAILURES = 3;
697
795
  * - DEPLOY_REQUESTS_PER_HOUR — deploys through a runner per org per hour (429 DEPLOY_RATE_LIMITED);
698
796
  * - MAX_ACTIVE_DEPLOYS_PER_RUNNER — active (queued|delivering|deploying) deploys per runner (429 TOO_MANY_DEPLOYS);
699
797
  * - RUNNER_DEPLOY_DEADLINE_MINUTES — an accepted deploy past this is cancelled and fails DEPLOY_TIMED_OUT;
700
- * - RUNNER_DEPLOY_STATUS_POLL_SECONDS — each deploying request's build is polled (signed deploy_status) this often.
798
+ * - RUNNER_DEPLOY_STATUS_POLL_SECONDS — each deploying request's build is polled (signed deploy_status) this often;
799
+ * - SOURCE_OPTIONS_REQUESTS_PER_MINUTE — source-option listings (a signed list_sources) per org per minute (above it the picker falls back to pasting an ARN);
800
+ * - SOURCE_OPTIONS_CACHE_SECONDS — how long one runner + region + repository's listing is reused.
701
801
  */
702
802
  export declare const RUNNER_TUNABLE_DEFAULTS: {
703
803
  readonly RUN_REQUESTS_PER_MINUTE: '6';
@@ -710,6 +810,8 @@ export declare const RUNNER_TUNABLE_DEFAULTS: {
710
810
  readonly MAX_ACTIVE_DEPLOYS_PER_RUNNER: '2';
711
811
  readonly RUNNER_DEPLOY_DEADLINE_MINUTES: '120';
712
812
  readonly RUNNER_DEPLOY_STATUS_POLL_SECONDS: '30';
813
+ readonly SOURCE_OPTIONS_REQUESTS_PER_MINUTE: '30';
814
+ readonly SOURCE_OPTIONS_CACHE_SECONDS: '60';
713
815
  };
714
816
  export type RunnerTunableEnv = keyof typeof RUNNER_TUNABLE_DEFAULTS;
715
817
  /** The smallest value each tunable accepts. */
@@ -1047,6 +1149,12 @@ export interface DeployLogHint {
1047
1149
  export declare function deployLogHint(runnerId: string, buildId: string | null): DeployLogHint;
1048
1150
  /** The command that turns deploys on for a runner. */
1049
1151
  export declare const DEPLOY_SETUP_COMMAND = "pipeline-manager infra setup-runner --enable-deploy";
1152
+ /**
1153
+ * The command that updates a runner without deploys to the current bundle and
1154
+ * role (`sources:1` and its read-only grants). A runner WITH deploys is updated
1155
+ * with {@link DEPLOY_SETUP_COMMAND}, so the update keeps them on.
1156
+ */
1157
+ export declare const SOURCES_SETUP_COMMAND = "pipeline-manager infra setup-runner";
1050
1158
  /** The facade routes under `/api/pipelines/runner/deploys/:requestId/`. `session` exchanges the grant; the rest take the session token. */
1051
1159
  export declare const DEPLOY_SESSION_LEAVES: readonly ['session', 'pipeline', 'plugin-lookup', 'progress', 'registry', 'result'];
1052
1160
  export type DeploySessionLeaf = (typeof DEPLOY_SESSION_LEAVES)[number];