@turboops/cli 1.0.33 → 1.0.35-dev.1085

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -194,7 +194,7 @@ function getPackageName() {
194
194
  }
195
195
 
196
196
  // src/services/config.ts
197
- var BUILD_ENV = true ? "prod" : void 0;
197
+ var BUILD_ENV = true ? "dev" : void 0;
198
198
  var API_URLS = {
199
199
  local: "http://localhost:3000",
200
200
  dev: "https://api.dev.turbo-ops.de",
@@ -2500,24 +2500,20 @@ import { readFileSync as readFileSync3, existsSync as existsSync4 } from "fs";
2500
2500
  import { resolve as resolve2 } from "path";
2501
2501
  import { Command as Command4 } from "commander";
2502
2502
  import chalk6 from "chalk";
2503
+ var DOCKER_TAG_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/;
2503
2504
  function detectCiCommitSha() {
2504
- if (process.env.CI_COMMIT_SHA) {
2505
- return process.env.CI_COMMIT_SHA;
2506
- }
2507
- if (process.env.GITHUB_SHA) {
2508
- return process.env.GITHUB_SHA;
2509
- }
2510
- if (process.env.BITBUCKET_COMMIT) {
2511
- return process.env.BITBUCKET_COMMIT;
2512
- }
2513
- if (process.env.BUILD_SOURCEVERSION) {
2514
- return process.env.BUILD_SOURCEVERSION;
2515
- }
2516
- if (process.env.CIRCLE_SHA1) {
2517
- return process.env.CIRCLE_SHA1;
2518
- }
2519
- if (process.env.GIT_COMMIT) {
2520
- return process.env.GIT_COMMIT;
2505
+ const candidates = [
2506
+ process.env.CI_COMMIT_SHA,
2507
+ process.env.GITHUB_SHA,
2508
+ process.env.BITBUCKET_COMMIT,
2509
+ process.env.BUILD_SOURCEVERSION,
2510
+ process.env.CIRCLE_SHA1,
2511
+ process.env.GIT_COMMIT
2512
+ ];
2513
+ for (const sha of candidates) {
2514
+ if (sha && DOCKER_TAG_REGEX.test(sha.trim())) {
2515
+ return sha.trim();
2516
+ }
2521
2517
  }
2522
2518
  return null;
2523
2519
  }
@@ -2541,14 +2537,20 @@ var deployCommand = new Command4("deploy").description("Trigger a deployment (fo
2541
2537
  logger.header(`Deploying: ${project.name} \u2192 ${env.name}`);
2542
2538
  const isFirstStage = !env.stageOrder || env.stageOrder === 0;
2543
2539
  let imageTag = options.image;
2540
+ if (imageTag && !DOCKER_TAG_REGEX.test(imageTag)) {
2541
+ logger.error(
2542
+ `Invalid image tag format: "${imageTag}". Must be alphanumeric with dots, dashes, or underscores.`
2543
+ );
2544
+ process.exit(11 /* CONFIG_ERROR */);
2545
+ }
2544
2546
  if (!imageTag) {
2545
2547
  if (isFirstStage) {
2546
2548
  const commitSha = detectCiCommitSha();
2547
2549
  const ciEnv = detectCiEnvironment();
2548
2550
  if (commitSha && ciEnv) {
2549
- imageTag = `${configService.getRegistryUrl()}/${project.slug}:${commitSha}`;
2551
+ imageTag = commitSha;
2550
2552
  logger.info(`CI/CD detected (${ciEnv})`);
2551
- logger.info(`Auto-using image: ${imageTag}`);
2553
+ logger.info(`Auto-using image tag: ${commitSha}`);
2552
2554
  }
2553
2555
  } else {
2554
2556
  const ciEnv = detectCiEnvironment();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turboops/cli",
3
- "version": "1.0.33",
3
+ "version": "1.0.35-dev.1085",
4
4
  "description": "TurboCLI - Command line interface for TurboOps deployments",
5
5
  "keywords": [
6
6
  "cli",