Skip to content

🎥 Make videos programmatically with React

remove all-regions arg for services

Matt McGillivray341828acefc0
diff --git a/packages/cloudrun/src/api/get-services.ts b/packages/cloudrun/src/api/get-services.ts
index 3fa9af93fa..757cd6fa48 100644
--- a/packages/cloudrun/src/api/get-services.ts
+++ b/packages/cloudrun/src/api/get-services.ts
@@ -1,4 +1,3 @@
-import {JWT} from 'google-auth-library';
import type {GcpRegion} from '../pricing/gcp-regions';
import {RENDER_SERVICE_PREFIX} from '../shared/constants';
import {serviceVersionString} from '../shared/service-version-string';
@@ -7,38 +6,10 @@ import {getCloudRunClient} from './helpers/get-cloud-run-client';
import type {IService} from './helpers/IService';
export type GetServicesInput = {
- region: GcpRegion | 'all regions';
+ region: GcpRegion;
compatibleOnly: boolean;
};
-type v1Data = {
- items: {
- metadata: {
- name: string;
- uid: string;
- labels: {
- 'cloud.googleapis.com/location': string;
- };
- creationTimestamp: string;
- };
- status: {
- url: string;
- };
- spec: {
- template: {
- spec: {
- timeoutSeconds: number;
- containers: {
- resources: {
- limits: {cpu: string; memory: string};
- };
- }[];
- };
- };
- };
- }[];
-};
-
/**
* @description Lists Remotion Cloud Run render services deployed to GCP Cloud Run.
* @see [Documentation](https://remotion.dev/docs/cloudrun/getservices)
@@ -50,41 +21,6 @@ type v1Data = {
export const getServices = async (
params: GetServicesInput
): Promise<ServiceInfo[]> => {
- if (params.region === 'all regions') {
- const cloudRunEndpoint = `https://run.googleapis.com/apis/serving.knative.dev/v1/namespaces/${process.env.REMOTION_GCP_PROJECT_ID}/services`;
-
- const client = new JWT({
- email: process.env.REMOTION_GCP_CLIENT_EMAIL,
- key: process.env.REMOTION_GCP_PRIVATE_KEY,
- scopes: ['https://www.googleapis.com/auth/cloud-platform'],
- });
-
- const res = await client.request({url: cloudRunEndpoint});
-
- const data = res.data as v1Data;
-
- return data.items.map((service): ServiceInfo => {
- const deployedRegion = service.metadata.labels[
- 'cloud.googleapis.com/location'
- ] as string;
-
- return {
- serviceName: service.metadata.name as string,
- timeoutInSeconds: service.spec.template.spec.timeoutSeconds as number,
- memoryLimit: service.spec.template.spec.containers?.[0].resources
- ?.limits?.memory as string,
- cpuLimit: service.spec.template.spec.containers?.[0].resources?.limits
- ?.cpu as string,
- remotionVersion: service.metadata.name
- .split('--')[1]
- .replace(/-/g, '.') as string,
- uri: service.status.url as string,
- region: deployedRegion as GcpRegion,
- consoleUrl: `https://console.cloud.google.com/run/detail/${deployedRegion}/${service.metadata.name}/logs`,
- };
- });
- }
-
const cloudRunClient = getCloudRunClient();
const parent = `projects/${process.env.REMOTION_GCP_PROJECT_ID}/locations/${params.region}`;
diff --git a/packages/cloudrun/src/cli/commands/services/ls.ts b/packages/cloudrun/src/cli/commands/services/ls.ts
index 5f86bb5da7..a5cb234783 100644
--- a/packages/cloudrun/src/cli/commands/services/ls.ts
+++ b/packages/cloudrun/src/cli/commands/services/ls.ts
@@ -1,16 +1,13 @@
import {CliInternals} from '@remotion/cli';
import {displayServiceInfo} from '.';
import {getServices} from '../../../api/get-services';
-import {parsedCloudrunCli} from '../../args';
import {getGcpRegion} from '../../get-gcp-region';
import {Log} from '../../log';
export const SERVICES_LS_SUBCOMMAND = 'ls';
export const servicesLsCommand = async () => {
- const allRegions = parsedCloudrunCli['all-regions'];
-
- const region = allRegions ? 'all regions' : getGcpRegion();
+ const region = getGcpRegion();
const fetchingOutput = CliInternals.createOverwriteableCliOutput({
quiet: CliInternals.quietFlagProvided(),
cancelSignal: null,
diff --git a/packages/cloudrun/src/cli/commands/services/rmall.ts b/packages/cloudrun/src/cli/commands/services/rmall.ts
index 6c26c9b386..b8ac1b6d6d 100644
--- a/packages/cloudrun/src/cli/commands/services/rmall.ts
+++ b/packages/cloudrun/src/cli/commands/services/rmall.ts
@@ -1,7 +1,6 @@
import {CliInternals} from '@remotion/cli';
import {deleteService} from '../../../api/delete-service';
import {getServices} from '../../../api/get-services';
-import {parsedCloudrunCli} from '../../args';
import {getGcpRegion} from '../../get-gcp-region';
import {confirmCli} from '../../helpers/confirm';
import {Log} from '../../log';
@@ -10,9 +9,7 @@ import {displayServiceInfo} from './index';
export const SERVICES_RMALL_SUBCOMMAND = 'rmall';
export const servicesRmallCommand = async () => {
- const allRegions = parsedCloudrunCli['all-regions'];
-
- const region = allRegions ? 'all regions' : getGcpRegion();
+ const region = getGcpRegion();
const fetchingOutput = CliInternals.createOverwriteableCliOutput({
quiet: CliInternals.quietFlagProvided(),
diff --git a/packages/docs/docs/cloudrun/cli/services.md b/packages/docs/docs/cloudrun/cli/services.md
index 31b1d2e0d5..422be48bb5 100644
--- a/packages/docs/docs/cloudrun/cli/services.md
+++ b/packages/docs/docs/cloudrun/cli/services.md
@@ -110,47 +110,6 @@ GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion
The [GCP region](/docs/cloudrun/region-selection) to list services from.
-### `--all-regions`,
-
-Ignores region, returning services across all regions for the project.
-
-```
-npx remotion cloudrun services ls --all-regions
-```
-
-<details>
-<summary>
-Example output
-</summary>
-<pre>
-3 services in all regions<br/><br/>
-Service name: remotion--3-3-82--mem512mi--cpu1-0--t-800<br/>
-Version: 3.3.82<br/>
-CPU Limit: 1.0<br/>
-Memory Limit: 512Mi<br/>
-Timeout: 800sec<br/>
-Region: us-central1<br/>
-Service URL: https://remotion--3-3-82--mem512mi--cpu1-0--t-800-1a2b3c4d5e-uc.a.run.app<br/>
-GCP Console URL: https://console.cloud.google.com/run/detail/us-central1/remotion--3-3-82--mem512mi--cpu1-0--t-800/logs<br/><br/>
-Service name: remotion--3-3-95--mem512mi--cpu2--t-1200<br/>
-Version: 3.3.95<br/>
-CPU Limit: 2<br/>
-Memory Limit: 512Mi<br/>
-Timeout: 1200sec<br/>
-Region: us-east1<br/>
-Service URL: https://remotion--3-3-95--mem512mi--cpu2--t-1200-1a2b3c4d5e-ue.a.run.app<br/>
-GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-95--mem512mi--cpu2--t-1200/logs<br/><br/>
-Service name: remotion--3-3-82--mem512mi--cpu1-0--t-800<br/>
-Version: 3.3.82<br/>
-CPU Limit: 1.0<br/>
-Memory Limit: 512Mi<br/>
-Timeout: 800sec<br/>
-Region: us-east1<br/>
-Service URL: https://remotion--3-3-82--mem512mi--cpu1-0--t-800-1a2b3c4d5e-ue.a.run.app<br/>
-GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-82--mem512mi--cpu1-0--t-800/logs
-</pre>
-</details>
-
### `--quiet`, `-q`
Prints only the service names in a space-separated list. If no services exist, prints `()`
@@ -188,10 +147,6 @@ Deleted!
The [GCP region](/docs/cloudrun/region-selection) to select.
-:::note
-The `rm` command does not support the --all-regions flag, as it is possible to have the same service name in multiple regions. This makes it difficult to remove multiple service names from multiple regions.
-:::
-
### `--yes`, `-y`
Skips confirmation.
@@ -202,7 +157,7 @@ Skips confirmation.
npx remotion cloudrun services rmall
```
-Removes all services from your GCP project for a certain region (or all regions if the --all-regions flag is passed).
+Removes all services from your GCP project for a certain region.
<details>
<summary>
@@ -237,52 +192,6 @@ Skipping service - remotion--3-3-82--mem512mi--cpu1-0--t-800.<br/>
The [GCP region](/docs/cloudrun/region-selection) to remove services from.
-### `--all-regions`,
-
-Ignores region, removing services across all regions for the project.
-
-```
-npx remotion cloudrun services rmall --all-regions
-```
-
-<details>
-<summary>
-Example output
-</summary>
-<pre>
-3 services in all regions<br/><br/>
-Service name: remotion--3-3-82--mem512mi--cpu1-0--t-800<br/>
-Version: 3.3.82<br/>
-CPU Limit: 1.0<br/>
-Memory Limit: 512Mi<br/>
-Timeout: 800sec<br/>
-Region: us-central1<br/>
-Service URL: https://remotion--3-3-82--mem512mi--cpu1-0--t-800-1a2b3c4d5e-ue.a.run.app<br/>
-GCP Console URL: https://console.cloud.google.com/run/detail/us-central1/remotion--3-3-82--mem512mi--cpu1-0--t-800/logs<br/><br/>
-Delete? (Y/n) n<br/>
-Service name: remotion--3-3-95--mem512mi--cpu2--t-1200<br/>
-Version: 3.3.95<br/>
-CPU Limit: 2<br/>
-Memory Limit: 512Mi<br/>
-Timeout: 1200sec<br/>
-Region: us-east1<br/>
-Service URL: https://remotion--3-3-95--mem512mi--cpu2--t-1200-1a2b3c4d5e-ue.a.run.app<br/>
-GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-95--mem512mi--cpu2--t-1200/logs<br/><br/>
-Delete? (Y/n) n<br/>
-Skipping service - remotion--3-3-95--mem512mi--cpu2--t-1200.<br/><br/>
-Service name: remotion--3-3-82--mem512mi--cpu1-0--t-800<br/>
-Version: 3.3.82<br/>
-CPU Limit: 1.0<br/>
-Memory Limit: 512Mi<br/>
-Timeout: 800sec<br/>
-Region: us-east1<br/>
-Service URL: https://remotion--3-3-82--mem512mi--cpu1-0--t-800-1a2b3c4d5e-ue.a.run.app<br/>
-GCP Console URL: https://console.cloud.google.com/run/detail/us-east1/remotion--3-3-82--mem512mi--cpu1-0--t-800/logs<br/><br/>
-Delete? (Y/n) n<br/>
-Skipping service - remotion--3-3-82--mem512mi--cpu1-0--t-800.<br/>
-</pre>
-</details>
-
### `--yes`, `-y`
Skips confirmation.