@datadog/datadog-ci-plugin-container-app 4.1.3 → 4.2.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/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  ## Azure Container Apps
2
2
 
3
- > **BETA**: This feature is in beta. To use it, you must set the environment variable `DD_BETA_COMMANDS_ENABLED=true`.
4
-
5
- You can use the CLI to instrument your Azure Container Apps with Datadog. The CLI enables instrumentation by modifying existing Container App configurations to include the Datadog sidecar to enable tracing, log collection, and custom metrics.
3
+ You can use the CLI to instrument your Azure Container Apps with Datadog. The CLI enables instrumentation by modifying existing Container App configurations to include the Datadog sidecar, which enables tracing, log collection, and custom metrics.
6
4
 
7
5
  See [the docs](https://docs.datadoghq.com/serverless/azure_container_apps/sidecar/) for language-specific application steps needed in addition to these commands.
8
6
 
@@ -16,7 +14,7 @@ Run `datadog-ci container-app instrument` to apply Datadog instrumentation to an
16
14
  # Instrument a Container App using subscription ID, resource group, and name
17
15
  datadog-ci container-app instrument \
18
16
  --subscription-id <subscription-id> \
19
- --resource-group <resource-group> \
17
+ --resource-group <resource-group-name> \
20
18
  --name <container-app-name>
21
19
 
22
20
  # Instrument a Container App using a full resource ID
@@ -31,7 +29,7 @@ datadog-ci container-app instrument \
31
29
  # Instrument with configuration
32
30
  datadog-ci container-app instrument \
33
31
  --subscription-id <subscription-id> \
34
- --resource-group <resource-group> \
32
+ --resource-group <resource-group-name> \
35
33
  --name <container-app-name> \
36
34
  --service my-service \
37
35
  --env prod \
@@ -40,7 +38,35 @@ datadog-ci container-app instrument \
40
38
  # Dry run to preview changes
41
39
  datadog-ci container-app instrument \
42
40
  --subscription-id <subscription-id> \
43
- --resource-group <resource-group> \
41
+ --resource-group <resource-group-name> \
42
+ --name <container-app-name> \
43
+ --dry-run
44
+ ```
45
+
46
+ ### `uninstrument`
47
+
48
+ Run `datadog-ci container-app uninstrument` to remove Datadog instrumentation from an Azure Container App. This command reverts the Container App configuration to its pre-instrumented state by removing the Datadog sidecar and associated environment variables.
49
+
50
+ ```bash
51
+ # Uninstrument a Container App using subscription ID, resource group, and name
52
+ datadog-ci container-app uninstrument \
53
+ --subscription-id <subscription-id> \
54
+ --resource-group <resource-group-name> \
55
+ --name <container-app-name>
56
+
57
+ # Uninstrument a Container App using a full resource ID
58
+ datadog-ci container-app uninstrument \
59
+ --resource-id "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.App/containerApps/{containerAppName}"
60
+
61
+ # Uninstrument multiple Container Apps using resource IDs
62
+ datadog-ci container-app uninstrument \
63
+ --resource-id <resource-id-1> \
64
+ --resource-id <resource-id-2>
65
+
66
+ # Dry run to preview changes
67
+ datadog-ci container-app uninstrument \
68
+ --subscription-id <subscription-id> \
69
+ --resource-group <resource-group-name> \
44
70
  --name <container-app-name> \
45
71
  --dry-run
46
72
  ```
@@ -49,7 +75,7 @@ datadog-ci container-app instrument \
49
75
 
50
76
  ### Azure Credentials
51
77
 
52
- You must have valid Azure credentials configured with access to the Container Apps where you are running any `datadog-ci container-app` command. The CLI uses the Azure SDK's default credential chain, which includes:
78
+ You must have valid Azure credentials configured with access to the Container Apps where you are running any `datadog-ci container-app` commands. The CLI uses the Azure SDK's default credential chain, which includes:
53
79
 
54
80
  - Environment variables
55
81
  - Managed Identity (when running in Azure)
@@ -57,7 +83,7 @@ You must have valid Azure credentials configured with access to the Container Ap
57
83
  - Visual Studio Code credentials
58
84
  - Azure PowerShell credentials
59
85
 
60
- For local development, ensure you're authenticated via the Azure CLI:
86
+ For local development, ensure you're authenticated through the Azure CLI:
61
87
  ```bash
62
88
  az login
63
89
  ```
@@ -68,42 +94,58 @@ You must expose these environment variables in the environment where you are run
68
94
 
69
95
  | Environment Variable | Description | Example |
70
96
  | -------------------- | ----------- | ------- |
71
- | `DD_BETA_COMMANDS_ENABLED` | **Required**. Must be set to `true` to enable beta commands. | `export DD_BETA_COMMANDS_ENABLED=true` |
72
97
  | `DD_API_KEY` | **Required**. Datadog API Key. Sets the `DD_API_KEY` environment variable on your Container App. For more information about getting a Datadog API key, see the [API key documentation][1]. | `export DD_API_KEY=<API_KEY>` |
73
- | `DD_SITE` | Set which Datadog site to send data. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, and `ddog-gov.com`. The default is `datadoghq.com`. | `export DD_SITE=datadoghq.com` |
98
+ | `DD_SITE` | Set which Datadog site to send data to. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, and `ddog-gov.com`. The default is `datadoghq.com`. | `export DD_SITE=datadoghq.com` |
74
99
 
75
100
  ### Arguments
76
101
 
77
102
  Configuration can be done using command-line arguments or a JSON configuration file (see the next section).
78
103
 
79
104
  #### `instrument`
80
- You can pass the following arguments to `instrument` to specify its behavior. These arguments will override the values set in the configuration file, if any.
105
+ You can pass the following arguments to `instrument` to specify its behavior. These arguments override the values set in the configuration file, if any.
81
106
 
107
+ <!-- BEGIN_USAGE:instrument -->
108
+ | Argument | Shorthand | Description | Default |
109
+ | -------- | --------- | ----------- | ------- |
110
+ | `--subscription-id` | `-s` | Subscription ID of the Azure subscription containing the Container App. Must be used with `--resource-group` and `--name`. | |
111
+ | `--resource-group` | `-g` | Name of the Azure Resource Group containing the Container App. Must be used with `--subscription-id` and `--name`. | |
112
+ | `--name` | `-n` | Name of the Azure Container App to instrument. Must be used with `--subscription-id` and `--resource-group`. | |
113
+ | `--resource-id` | `-r` | Full Azure resource ID to instrument. Can be specified multiple times. Format: `/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.App/containerApps/<container-app-name>`. | |
114
+ | `--env-vars` | `-e` | Additional environment variables to set for the Container App. Can specify multiple variables in the format `--env-vars VAR1=VALUE1 --env-vars VAR2=VALUE2`. | |
115
+ | `--config` | | Path to the configuration file. | |
116
+ | `--dry-run` | `-d` | Run the command in dry-run mode, without making any changes. Preview the changes that running the command would apply. | `false` |
117
+ | `--service` | | The value for the service tag. Use this to group related Container Apps belonging to similar workloads. For example, `my-service`. If not provided, the Container App name is used. | |
118
+ | `--env` or `--environment` | | The value for the env tag. Use this to separate your staging, development, and production environments. For example, `prod`. | |
119
+ | `--version` | | The value for the version tag. Use this to correlate spikes in latency, load, or errors to new versions. For example, `1.0.0`. | |
120
+ | `--sidecar-name` | | (Not recommended) The name to use for the sidecar container. | `DEFAULT_SIDECAR_NAME` |
121
+ | `--shared-volume-name` | | (Not recommended) Specify a custom shared volume name. | `DEFAULT_VOLUME_NAME` |
122
+ | `--shared-volume-path` | | (Not recommended) Specify a custom shared volume path. | `DEFAULT_VOLUME_PATH` |
123
+ | `--logs-path` | | (Not recommended) Specify a custom log file path. Must begin with the shared volume path. | `DEFAULT_LOGS_PATH` |
124
+ | `--source-code-integration` or `--sourceCodeIntegration` | | Whether to enable the Datadog Source Code integration. This tags your service(s) with the Git repository and the latest commit hash of the local directory. Specify `--no-source-code-integration` to disable. | `true` |
125
+ | `--upload-git-metadata` or `--uploadGitMetadata` | | Whether to enable Git metadata uploading, as a part of the source code integration. Git metadata uploading is only required if you don't have the Datadog GitHub integration installed. Specify `--no-upload-git-metadata` to disable. | `true` |
126
+ | `--extra-tags` or `--extraTags` | | Additional tags to add to the service in the format "key1:value1,key2:value2". | |
127
+ <!-- END_USAGE:instrument -->
128
+
129
+ #### `uninstrument`
130
+ You can pass the following arguments to `uninstrument` to specify its behavior. These arguments override the values set in the configuration file, if any.
131
+
132
+ <!-- BEGIN_USAGE:uninstrument -->
82
133
  | Argument | Shorthand | Description | Default |
83
134
  | -------- | --------- | ----------- | ------- |
84
- | `--subscription-id` | `-s` | Azure Subscription ID containing the Container App. Must be used with `--resource-group` and `--name`. | |
85
- | `--resource-group` | `-g` | Name of the Azure Resource Group containing the Container App. Must be used with `--subscription-id` and `--name`. | |
86
- | `--name` | `-n` | Name of the Azure Container App to instrument. Must be used with `--subscription-id` and `--resource-group`. | |
87
- | `--resource-id` | `-r` | Full Azure resource ID to instrument. Can be specified multiple times. Format: `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.App/containerApps/{containerAppName}` | |
88
- | `--service` | | The value for the service tag. Use this to group related Container Apps belonging to similar workloads. For example, `my-service` | |
89
- | `--env` or `--environment` | | The value for the env tag. Use this to separate out your staging, development, and production environments. For example, `prod` | |
90
- | `--version` | | The value for the version tag. Use this to correlate spikes in latency, load, or errors to new versions. For example, `1.0.0` | |
91
- | `--instance-logging` | | When enabled, log collection is automatically configured for an additional file path: `/home/LogFiles/*$COMPUTERNAME*.log` | `false` |
92
- | `--shared-volume-name` | | (Not recommended) Specify a custom shared volume name. | `shared-volume` |
93
- | `--shared-volume-path` | | (Not recommended) Specify a custom shared volume path. | `/shared-volume` |
94
- | `--logs-path` | | (Not recommended) Specify a custom log file path. Must begin with the shared volume path. | `/shared-volume/logs/*.log` |
95
- | `--source-code-integration` or `--sourceCodeIntegration` | | Enable source code integration to add git metadata as tags. Specify `--no-source-code-integration` to disable. | `true` |
96
- | `--upload-git-metadata` or `--uploadGitMetadata` | | Upload git metadata to Datadog. Only required if you don't have the Datadog GitHub Integration installed. Specify `--no-upload-git-metadata` to disable. | `true` |
97
- | `--extra-tags` or `--extraTags` | | Additional tags to add to the service in the format `key1:value1,key2:value2` | |
98
- | `--env-vars` | `-e` | Additional environment variables to set for the Container App. Can specify multiple in the form `--env-vars VAR1=VALUE1 --env-vars VAR2=VALUE2` | |
135
+ | `--subscription-id` | `-s` | Subscription ID of the Azure subscription containing the Container App. Must be used with `--resource-group` and `--name`. | |
136
+ | `--resource-group` | `-g` | Name of the Azure Resource Group containing the Container App. Must be used with `--subscription-id` and `--name`. | |
137
+ | `--name` | `-n` | Name of the Azure Container App to instrument. Must be used with `--subscription-id` and `--resource-group`. | |
138
+ | `--resource-id` | `-r` | Full Azure resource ID to instrument. Can be specified multiple times. Format: `/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.App/containerApps/<container-app-name>`. | |
139
+ | `--env-vars` | `-e` | Additional environment variables to set for the Container App. Can specify multiple variables in the format `--env-vars VAR1=VALUE1 --env-vars VAR2=VALUE2`. | |
140
+ | `--config` | | Path to the configuration file. | |
99
141
  | `--dry-run` | `-d` | Run the command in dry-run mode, without making any changes. Preview the changes that running the command would apply. | `false` |
100
- | `--config` | | Path to a configuration file. See the configuration file section below. | |
101
- | `--fips` | | Enable FIPS support for the Container App. | `false` |
102
- | `--fips-ignore-error` | | Ignore errors when enabling FIPS support. | `false` |
142
+ | `--sidecar-name` | | The name of the sidecar container to remove. Specify if you have a different sidecar name. | `DEFAULT_SIDECAR_NAME` |
143
+ | `--shared-volume-name` | | The name of the shared volume to remove. Specify if you have a different shared volume name. | `DEFAULT_VOLUME_NAME` |
144
+ <!-- END_USAGE:uninstrument -->
103
145
 
104
146
  ### Configuration file
105
147
 
106
- Instead of supplying arguments, you can create a configuration file in your project and simply run the `datadog-ci container-app instrument --config datadog-ci.json` command. Specify the `datadog-ci.json` using the `--config` argument, and use this configuration file structure:
148
+ Instead of supplying arguments, you can create a configuration file in your project and run the `datadog-ci container-app instrument --config datadog-ci.json` command. Specify the `datadog-ci.json` file using the `--config` argument, and use this configuration file structure:
107
149
 
108
150
  ```json
109
151
  {
@@ -115,7 +157,6 @@ Instead of supplying arguments, you can create a configuration file in your proj
115
157
  "environment": "prod",
116
158
  "version": "1.0.0",
117
159
  "logPath": "/home/LogFiles/*.log",
118
- "isInstanceLoggingEnabled": false,
119
160
  "sourceCodeIntegration": true,
120
161
  "uploadGitMetadata": true,
121
162
  "extraTags": "team:backend,project:api",
@@ -133,8 +174,8 @@ Alternatively, you can use resource IDs:
133
174
  {
134
175
  "containerApp": {
135
176
  "resourceIds": [
136
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.App/containerApps/{containerAppName1}",
137
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.App/containerApps/{containerAppName2}"
177
+ "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.App/containerApps/<container-app-name1>",
178
+ "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.App/containerApps/<container-app-name2>"
138
179
  ],
139
180
  "service": "my-service",
140
181
  "environment": "prod"
@@ -147,8 +188,7 @@ Alternatively, you can use resource IDs:
147
188
  ### Basic instrumentation
148
189
 
149
190
  ```bash
150
- export DD_BETA_COMMANDS_ENABLED=true
151
- export DD_API_KEY=your-api-key
191
+ export DD_API_KEY=<your-api-key>
152
192
  export DD_SITE=datadoghq.com
153
193
 
154
194
  datadog-ci container-app instrument \
@@ -160,8 +200,7 @@ datadog-ci container-app instrument \
160
200
  ### Instrumentation with tags and version
161
201
 
162
202
  ```bash
163
- export DD_BETA_COMMANDS_ENABLED=true
164
- export DD_API_KEY=your-api-key
203
+ export DD_API_KEY=<your-api-key>
165
204
 
166
205
  datadog-ci container-app instrument \
167
206
  --subscription-id 12345678-1234-1234-1234-123456789012 \
@@ -176,23 +215,20 @@ datadog-ci container-app instrument \
176
215
  ### Instrumentation with custom logging
177
216
 
178
217
  ```bash
179
- export DD_BETA_COMMANDS_ENABLED=true
180
- export DD_API_KEY=your-api-key
218
+ export DD_API_KEY=<your-api-key>
181
219
 
182
220
  datadog-ci container-app instrument \
183
221
  --subscription-id 12345678-1234-1234-1234-123456789012 \
184
222
  --resource-group my-resource-group \
185
223
  --name my-container-app \
186
224
  --log-path /home/LogFiles/myapp/*.log \
187
- --instance-logging
188
225
  ```
189
226
 
190
227
 
191
228
  ### Dry run to preview changes
192
229
 
193
230
  ```bash
194
- export DD_BETA_COMMANDS_ENABLED=true
195
- export DD_API_KEY=your-api-key
231
+ export DD_API_KEY=<your-api-key>
196
232
 
197
233
  datadog-ci container-app instrument \
198
234
  --subscription-id 12345678-1234-1234-1234-123456789012 \
@@ -13,4 +13,5 @@ export declare class PluginCommand extends ContainerAppInstrumentCommand {
13
13
  processContainerApp(containerAppClient: ContainerAppsAPIClient, config: ContainerAppConfigOptions, resourceGroup: string, containerAppName: string): Promise<boolean>;
14
14
  addTags(config: ContainerAppConfigOptions, subscriptionId: string, resourceGroup: string, containerApp: ContainerApp): Promise<void>;
15
15
  instrumentSidecar(client: ContainerAppsAPIClient, config: ContainerAppConfigOptions, resourceGroup: string, containerApp: ContainerApp): Promise<void>;
16
+ createInstrumentedAppConfig(config: ContainerAppConfigOptions, subscriptionId: string, resourceGroup: string, containerApp: ContainerApp): ContainerApp;
16
17
  }
@@ -21,13 +21,13 @@ const constants_1 = require("@datadog/datadog-ci-base/constants");
21
21
  const apikey_1 = require("@datadog/datadog-ci-base/helpers/apikey");
22
22
  const renderer_1 = require("@datadog/datadog-ci-base/helpers/renderer");
23
23
  const azure_1 = require("@datadog/datadog-ci-base/helpers/serverless/azure");
24
+ const common_1 = require("@datadog/datadog-ci-base/helpers/serverless/common");
24
25
  const constants_2 = require("@datadog/datadog-ci-base/helpers/serverless/constants");
25
26
  const source_code_integration_1 = require("@datadog/datadog-ci-base/helpers/serverless/source-code-integration");
26
27
  const tags_1 = require("@datadog/datadog-ci-base/helpers/tags");
27
28
  const utils_1 = require("@datadog/datadog-ci-base/helpers/utils");
28
29
  const chalk_1 = __importDefault(require("chalk"));
29
- const es6_1 = __importDefault(require("fast-deep-equal/es6"));
30
- const common_1 = require("../common");
30
+ const common_2 = require("../common");
31
31
  class PluginCommand extends instrument_1.ContainerAppInstrumentCommand {
32
32
  execute() {
33
33
  var _a, _b, _c;
@@ -109,7 +109,7 @@ class PluginCommand extends instrument_1.ContainerAppInstrumentCommand {
109
109
  if (config.version) {
110
110
  updatedTags.version = config.version;
111
111
  }
112
- if (!(0, es6_1.default)(containerApp.tags, updatedTags)) {
112
+ if (!(0, common_1.sortedEqual)(containerApp.tags, updatedTags)) {
113
113
  this.context.stdout.write(`${this.dryRunPrefix}Updating tags for ${chalk_1.default.bold(containerApp.name)}\n`);
114
114
  if (!this.dryRun) {
115
115
  try {
@@ -123,62 +123,58 @@ class PluginCommand extends instrument_1.ContainerAppInstrumentCommand {
123
123
  });
124
124
  }
125
125
  instrumentSidecar(client, config, resourceGroup, containerApp) {
126
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
127
126
  return __awaiter(this, void 0, void 0, function* () {
128
- // TODO add main container env vars (dd service, env, version)
129
- const envVarsByName = (0, common_1.getEnvVarsByName)(config, client.subscriptionId, resourceGroup);
130
- const containers = (_b = (_a = containerApp.template) === null || _a === void 0 ? void 0 : _a.containers) !== null && _b !== void 0 ? _b : [];
131
- const secrets = (_d = (_c = containerApp.configuration) === null || _c === void 0 ? void 0 : _c.secrets) !== null && _d !== void 0 ? _d : [];
132
- const volumes = (_f = (_e = containerApp.template) === null || _e === void 0 ? void 0 : _e.volumes) !== null && _f !== void 0 ? _f : [];
133
- const sidecarContainer = containers.find((c) => c.name === constants_2.SIDECAR_CONTAINER_NAME);
134
- const apiKeySecret = (_h = (_g = containerApp.configuration) === null || _g === void 0 ? void 0 : _g.secrets) === null || _h === void 0 ? void 0 : _h.find(({ name }) => name === common_1.DD_API_KEY_SECRET_NAME);
135
- // checks for if we should make changes
136
- const sidecarHasCorrectImage = (sidecarContainer === null || sidecarContainer === void 0 ? void 0 : sidecarContainer.image) === constants_2.SIDECAR_IMAGE;
137
- const hasCorrectEnvVars = (0, es6_1.default)(Object.fromEntries(((_j = sidecarContainer === null || sidecarContainer === void 0 ? void 0 : sidecarContainer.env) !== null && _j !== void 0 ? _j : []).map((env) => [env.name, env])), envVarsByName);
138
- const hasApiKey = (apiKeySecret === null || apiKeySecret === void 0 ? void 0 : apiKeySecret.value) === process.env.DD_API_KEY;
139
- const hasSharedVolume = volumes.some((v) => v.name === config.sharedVolumeName);
140
- const sidecarHasVolumeMount = (_k = sidecarContainer === null || sidecarContainer === void 0 ? void 0 : sidecarContainer.volumeMounts) === null || _k === void 0 ? void 0 : _k.some((mount) => mount.volumeName === config.sharedVolumeName && mount.mountPath === config.sharedVolumePath);
141
- if (sidecarHasCorrectImage && hasCorrectEnvVars && hasApiKey && hasSharedVolume && sidecarHasVolumeMount) {
142
- this.context.stdout.write(`${this.dryRunPrefix}Sidecar container ${chalk_1.default.bold(constants_2.SIDECAR_CONTAINER_NAME)} already exists with correct configuration.\n`);
127
+ const updatedAppConfig = this.createInstrumentedAppConfig(config, client.subscriptionId, resourceGroup, containerApp);
128
+ if ((0, common_1.sortedEqual)(containerApp, updatedAppConfig)) {
129
+ this.context.stdout.write(`${this.dryRunPrefix}Sidecar container ${chalk_1.default.bold(config.sidecarName)} already exists with correct configuration.\n`);
143
130
  return;
144
131
  }
145
- this.context.stdout.write(`${this.dryRunPrefix}Updating configuration for ${chalk_1.default.bold(containerApp.name)}\n`);
132
+ const configDiff = (0, common_1.generateConfigDiff)(containerApp, updatedAppConfig);
133
+ this.context.stdout.write(`${this.dryRunPrefix}Updating configuration for ${chalk_1.default.bold(containerApp.name)}:\n${configDiff}\n`);
146
134
  if (!this.dryRun) {
147
- const sharedVolume = {
148
- volumeName: config.sharedVolumeName,
149
- mountPath: config.sharedVolumePath,
150
- };
151
- // Update the Container App template with the Datadog sidecar and volume mounts
152
- const newSidecar = Object.assign(Object.assign({ name: constants_2.SIDECAR_CONTAINER_NAME, image: constants_2.SIDECAR_IMAGE, env: Object.values(envVarsByName) }, { volumeMounts: [sharedVolume] }), { resources: {
153
- cpu: 0.25,
154
- memory: '0.5Gi',
155
- } });
156
- // Update all app containers to add volume mounts
157
- const updatedContainers = containers.map((container) => {
158
- var _a, _b;
159
- const volumeMounts = (_a = container.volumeMounts) !== null && _a !== void 0 ? _a : [];
160
- const currentEnvVarsByName = Object.fromEntries(((_b = container.env) !== null && _b !== void 0 ? _b : []).map((env) => [env.name, env]));
161
- return Object.assign(Object.assign(Object.assign({}, container), { env: Object.values(Object.assign(Object.assign({}, currentEnvVarsByName), envVarsByName)) }), {
162
- volumeMounts: volumeMounts.some((mount) => mount.volumeName === config.sharedVolumeName)
163
- ? volumeMounts
164
- : [...volumeMounts, { volumeName: config.sharedVolumeName, mountPath: config.sharedVolumePath }],
165
- });
166
- });
167
- // Add sidecar if it doesn't exist
168
- if (!sidecarContainer) {
169
- updatedContainers.push(newSidecar);
170
- }
171
- const newApiKeySecret = {
172
- name: common_1.DD_API_KEY_SECRET_NAME,
173
- value: process.env.DD_API_KEY,
174
- };
175
- const updatedApp = Object.assign(Object.assign({}, containerApp), { configuration: Object.assign(Object.assign({}, containerApp.configuration), { secrets: apiKeySecret
176
- ? secrets.map((s) => (s.name === common_1.DD_API_KEY_SECRET_NAME ? newApiKeySecret : s))
177
- : [...secrets, newApiKeySecret] }), template: Object.assign(Object.assign({}, containerApp.template), { containers: updatedContainers, volumes: hasSharedVolume ? volumes : [...volumes, { name: config.sharedVolumeName, storageType: 'EmptyDir' }] }) });
178
- yield client.containerApps.beginUpdateAndWait(resourceGroup, containerApp.name, updatedApp);
135
+ yield client.containerApps.beginUpdateAndWait(resourceGroup, containerApp.name, updatedAppConfig);
179
136
  }
180
137
  });
181
138
  }
139
+ createInstrumentedAppConfig(config, subscriptionId, resourceGroup, containerApp) {
140
+ var _a, _b, _c;
141
+ const envVarsByName = (0, common_2.getEnvVarsByName)(config, subscriptionId, resourceGroup);
142
+ // Build base sidecar container
143
+ const baseSidecar = {
144
+ name: config.sidecarName,
145
+ image: constants_2.SIDECAR_IMAGE,
146
+ resources: {
147
+ cpu: 0.25,
148
+ memory: '0.5Gi',
149
+ },
150
+ probes: [
151
+ {
152
+ type: 'Startup',
153
+ tcpSocket: {
154
+ port: constants_2.DEFAULT_HEALTH_CHECK_PORT,
155
+ },
156
+ initialDelaySeconds: 0,
157
+ periodSeconds: 10,
158
+ failureThreshold: 3,
159
+ timeoutSeconds: 1,
160
+ },
161
+ ],
162
+ };
163
+ // Use shared helper to create instrumented template
164
+ const updatedTemplate = (0, common_1.createInstrumentedTemplate)((_a = containerApp.template) !== null && _a !== void 0 ? _a : {}, baseSidecar, {
165
+ name: config.sharedVolumeName,
166
+ mountPath: config.sharedVolumePath,
167
+ mountOptions: { storageType: 'EmptyDir' },
168
+ volumeMountNameKey: 'volumeName',
169
+ }, envVarsByName);
170
+ const secrets = (_c = (_b = containerApp.configuration) === null || _b === void 0 ? void 0 : _b.secrets) !== null && _c !== void 0 ? _c : [];
171
+ const hasApiKey = secrets.some(({ name }) => name === common_2.DD_API_KEY_SECRET_NAME);
172
+ const updatedSecrets = secrets.map((secret) => secret.name === common_2.DD_API_KEY_SECRET_NAME ? { name: common_2.DD_API_KEY_SECRET_NAME, value: process.env.DD_API_KEY } : secret);
173
+ if (!hasApiKey) {
174
+ updatedSecrets.push({ name: common_2.DD_API_KEY_SECRET_NAME, value: process.env.DD_API_KEY });
175
+ }
176
+ return Object.assign(Object.assign({}, containerApp), { configuration: Object.assign(Object.assign({}, containerApp.configuration), { secrets: updatedSecrets }), template: updatedTemplate });
177
+ }
182
178
  }
183
179
  exports.PluginCommand = PluginCommand;
184
180
  //# sourceMappingURL=instrument.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../src/commands/instrument.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAA6G;AAC7G,wDAA6E;AAC7E,8CAAsD;AAEtD,2FAAwG;AACxG,kEAAmE;AACnE,oEAA0E;AAC1E,wEAAwF;AACxF,6EAA8F;AAC9F,qFAA2G;AAC3G,iHAA+G;AAC/G,gEAAuH;AACvH,kEAAiE;AACjE,kDAAyB;AACzB,8DAAuC;AAEvC,sCAAkE;AAElE,MAAa,aAAc,SAAQ,0CAA6B;IAIjD,OAAO;;;YAClB,IAAI,CAAC,UAAU,EAAE,CAAA;YACjB,MAAM,CAAC,yBAAyB,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;YAC7E,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;gBACrB,KAA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AAM,cAAc,GAAa,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACtD,MAAM,CAAC,IAAI,KAAK,+BAAsB,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,+BAAsB,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,UAAW,EAAC,CAAC,CAAC,CAAC,MAAM,CACjH,CAAA;QACD,IAAI,CAAC,SAAS,EAAE;YACd,cAAc,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,+BAAsB,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,UAAW,EAAC,CAAC,CAAA;SACpF;QAED,uCACK,YAAY,KACf,aAAa,kCAAM,YAAY,CAAC,aAAa,KAAE,OAAO,EAAE,cAAc,KACtE,QAAQ,EAAE,eAAe,IAC1B;IACH,CAAC;CACF;AA3OD,sCA2OC"}
@@ -0,0 +1,18 @@
1
+ import { ContainerAppsAPIClient, ContainerApp } from '@azure/arm-appcontainers';
2
+ import { ContainerAppConfigOptions } from '@datadog/datadog-ci-base/commands/container-app/common';
3
+ import { ContainerAppUninstrumentCommand } from '@datadog/datadog-ci-base/commands/container-app/uninstrument';
4
+ export declare class PluginCommand extends ContainerAppUninstrumentCommand {
5
+ private cred;
6
+ private tagClient;
7
+ execute(): Promise<0 | 1>;
8
+ processSubscription(subscriptionId: string, resourceGroupToNames: Record<string, string[]>, config: ContainerAppConfigOptions): Promise<boolean>;
9
+ /**
10
+ * Process an Azure Container App for uninstrumentation.
11
+ * @returns A promise that resolves to a boolean indicating success or failure.
12
+ */
13
+ processContainerApp(containerAppClient: ContainerAppsAPIClient, config: ContainerAppConfigOptions, resourceGroup: string, containerAppName: string, subscriptionId: string): Promise<boolean>;
14
+ removeTags(subscriptionId: string, resourceGroup: string, containerApp: ContainerApp): Promise<void>;
15
+ uninstrumentSidecar(client: ContainerAppsAPIClient, config: ContainerAppConfigOptions, resourceGroup: string, containerApp: ContainerApp): Promise<void>;
16
+ createUninstrumentedAppConfig(config: ContainerAppConfigOptions, containerApp: ContainerApp): ContainerApp;
17
+ private updateAppContainer;
18
+ }
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.PluginCommand = void 0;
16
+ const arm_appcontainers_1 = require("@azure/arm-appcontainers");
17
+ const arm_resources_1 = require("@azure/arm-resources");
18
+ const identity_1 = require("@azure/identity");
19
+ const uninstrument_1 = require("@datadog/datadog-ci-base/commands/container-app/uninstrument");
20
+ const renderer_1 = require("@datadog/datadog-ci-base/helpers/renderer");
21
+ const azure_1 = require("@datadog/datadog-ci-base/helpers/serverless/azure");
22
+ const common_1 = require("@datadog/datadog-ci-base/helpers/serverless/common");
23
+ const tags_1 = require("@datadog/datadog-ci-base/helpers/tags");
24
+ const chalk_1 = __importDefault(require("chalk"));
25
+ const common_2 = require("../common");
26
+ class PluginCommand extends uninstrument_1.ContainerAppUninstrumentCommand {
27
+ execute() {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ this.enableFips();
30
+ const [containerAppsToUninstrument, config, errors] = yield this.ensureConfig();
31
+ if (errors.length > 0) {
32
+ for (const error of errors) {
33
+ this.context.stdout.write((0, renderer_1.renderError)(error));
34
+ }
35
+ return 1;
36
+ }
37
+ this.cred = new identity_1.DefaultAzureCredential();
38
+ if (!(yield (0, azure_1.ensureAzureAuth)((msg) => this.context.stdout.write(msg), this.cred))) {
39
+ return 1;
40
+ }
41
+ this.tagClient = new arm_resources_1.ResourceManagementClient(this.cred).tagsOperations;
42
+ this.context.stdout.write(`${this.dryRunPrefix}🐶 Beginning uninstrumentation of Azure Container App(s)\n`);
43
+ const results = yield Promise.all(Object.entries(containerAppsToUninstrument).map(([subscriptionId, resourceGroupToNames]) => this.processSubscription(subscriptionId, resourceGroupToNames, config)));
44
+ const success = results.every((result) => result);
45
+ this.context.stdout.write(`${this.dryRunPrefix}🐶 Uninstrumentation completed ${success ? 'successfully!' : 'with errors, see above for details.'}\n`);
46
+ return success ? 0 : 1;
47
+ });
48
+ }
49
+ processSubscription(subscriptionId, resourceGroupToNames, config) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ const containerAppClient = new arm_appcontainers_1.ContainerAppsAPIClient(this.cred, subscriptionId);
52
+ const results = yield Promise.all(Object.entries(resourceGroupToNames).flatMap(([resourceGroup, containerAppNames]) => containerAppNames.map((containerAppName) => this.processContainerApp(containerAppClient, config, resourceGroup, containerAppName, subscriptionId))));
53
+ return results.every((result) => result);
54
+ });
55
+ }
56
+ /**
57
+ * Process an Azure Container App for uninstrumentation.
58
+ * @returns A promise that resolves to a boolean indicating success or failure.
59
+ */
60
+ processContainerApp(containerAppClient, config, resourceGroup, containerAppName, subscriptionId) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ try {
63
+ const containerApp = yield containerAppClient.containerApps.get(resourceGroup, containerAppName);
64
+ yield this.uninstrumentSidecar(containerAppClient, config, resourceGroup, containerApp);
65
+ yield this.removeTags(subscriptionId, resourceGroup, containerApp);
66
+ }
67
+ catch (error) {
68
+ this.context.stdout.write((0, renderer_1.renderError)(`Failed to uninstrument ${containerAppName}: ${(0, azure_1.formatError)(error)}`));
69
+ return false;
70
+ }
71
+ return true;
72
+ });
73
+ }
74
+ removeTags(subscriptionId, resourceGroup, containerApp) {
75
+ var _a, _b, _c, _d;
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const updatedTags = Object.assign({}, containerApp.tags);
78
+ delete updatedTags.service;
79
+ delete updatedTags.env;
80
+ delete updatedTags.version;
81
+ delete updatedTags[tags_1.SERVERLESS_CLI_VERSION_TAG_NAME];
82
+ const tagsChanged = ((_a = containerApp.tags) === null || _a === void 0 ? void 0 : _a.service) ||
83
+ ((_b = containerApp.tags) === null || _b === void 0 ? void 0 : _b.env) ||
84
+ ((_c = containerApp.tags) === null || _c === void 0 ? void 0 : _c.version) ||
85
+ ((_d = containerApp.tags) === null || _d === void 0 ? void 0 : _d[tags_1.SERVERLESS_CLI_VERSION_TAG_NAME]);
86
+ if (tagsChanged) {
87
+ this.context.stdout.write(`${this.dryRunPrefix}Removing tags from ${chalk_1.default.bold(containerApp.name)}\n`);
88
+ if (!this.dryRun) {
89
+ try {
90
+ yield this.tagClient.beginCreateOrUpdateAtScopeAndWait(`/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.App/containerApps/${containerApp.name}`, { properties: { tags: updatedTags } });
91
+ }
92
+ catch (error) {
93
+ this.context.stdout.write((0, renderer_1.renderError)(`Failed to remove tags from ${chalk_1.default.bold(containerApp.name)}: ${(0, azure_1.formatError)(error)}`));
94
+ }
95
+ }
96
+ }
97
+ });
98
+ }
99
+ uninstrumentSidecar(client, config, resourceGroup, containerApp) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ const updatedAppConfig = this.createUninstrumentedAppConfig(config, containerApp);
102
+ const configDiff = (0, common_1.generateConfigDiff)(containerApp, updatedAppConfig);
103
+ this.context.stdout.write(`${this.dryRunPrefix}Updating configuration for ${chalk_1.default.bold(containerApp.name)}:\n${configDiff}\n`);
104
+ if (!this.dryRun) {
105
+ yield client.containerApps.beginUpdateAndWait(resourceGroup, containerApp.name, updatedAppConfig);
106
+ }
107
+ });
108
+ }
109
+ createUninstrumentedAppConfig(config, containerApp) {
110
+ var _a, _b, _c, _d, _e;
111
+ const containers = (_b = (_a = containerApp === null || containerApp === void 0 ? void 0 : containerApp.template) === null || _a === void 0 ? void 0 : _a.containers) !== null && _b !== void 0 ? _b : [];
112
+ const volumes = ((_c = containerApp === null || containerApp === void 0 ? void 0 : containerApp.template) === null || _c === void 0 ? void 0 : _c.volumes) || [];
113
+ // Remove sidecar container
114
+ let updatedContainers = containers.filter((c) => c.name !== config.sidecarName);
115
+ if (updatedContainers.length === containers.length) {
116
+ this.context.stdout.write((0, renderer_1.renderSoftWarning)(`Sidecar container '${config.sidecarName}' not found, so no container was removed. Specify the container name with --sidecar-name.\n`));
117
+ }
118
+ // Remove shared volume
119
+ const updatedVolumes = volumes.filter((v) => v.name !== config.sharedVolumeName);
120
+ // Update app containers to remove volume mounts and DD_* env vars
121
+ updatedContainers = updatedContainers.map((c) => this.updateAppContainer(c, config));
122
+ // Remove DD_API_KEY secret
123
+ const secrets = (_e = (_d = containerApp.configuration) === null || _d === void 0 ? void 0 : _d.secrets) !== null && _e !== void 0 ? _e : [];
124
+ const updatedSecrets = secrets.filter((secret) => secret.name !== common_2.DD_API_KEY_SECRET_NAME);
125
+ return Object.assign(Object.assign({}, containerApp), { configuration: Object.assign(Object.assign({}, containerApp.configuration), { secrets: updatedSecrets }), template: Object.assign(Object.assign({}, containerApp.template), { containers: updatedContainers, volumes: updatedVolumes }) });
126
+ }
127
+ // Remove volume mount, DD_* env vars, and custom env vars
128
+ updateAppContainer(appContainer, config) {
129
+ const existingVolumeMounts = appContainer.volumeMounts || [];
130
+ const updatedVolumeMounts = existingVolumeMounts.filter((v) => v.volumeName !== config.sharedVolumeName);
131
+ const customEnvVars = (0, common_1.parseEnvVars)(config.envVars);
132
+ const existingEnvVars = appContainer.env || [];
133
+ // Remove env vars beginning with DD_ and custom env vars
134
+ const updatedEnvVars = existingEnvVars.filter((v) => v.name && !v.name.startsWith('DD_') && !(v.name in customEnvVars));
135
+ return Object.assign(Object.assign({}, appContainer), { volumeMounts: updatedVolumeMounts, env: updatedEnvVars });
136
+ }
137
+ }
138
+ exports.PluginCommand = PluginCommand;
139
+ //# sourceMappingURL=uninstrument.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uninstrument.js","sourceRoot":"","sources":["../../src/commands/uninstrument.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAqG;AACrG,wDAA6E;AAC7E,8CAAsD;AAEtD,+FAA4G;AAC5G,wEAAwF;AACxF,6EAA8F;AAC9F,+EAAmG;AACnG,gEAAqF;AACrF,kDAAyB;AAEzB,sCAAgD;AAEhD,MAAa,aAAc,SAAQ,8CAA+B;IAInD,OAAO;;YAClB,IAAI,CAAC,UAAU,EAAE,CAAA;YACjB,MAAM,CAAC,2BAA2B,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;YAC/E,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;gBACrB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;oBAC1B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAA,sBAAW,EAAC,KAAK,CAAC,CAAC,CAAA;iBAC9C;gBAED,OAAO,CAAC,CAAA;aACT;YAED,IAAI,CAAC,IAAI,GAAG,IAAI,iCAAsB,EAAE,CAAA;YACxC,IAAI,CAAC,CAAC,MAAM,IAAA,uBAAe,EAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE;gBAChF,OAAO,CAAC,CAAA;aACT;YACD,IAAI,CAAC,SAAS,GAAG,IAAI,wCAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,cAAc,CAAA;YAEvE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,YAAY,4DAA4D,CAAC,CAAA;YAC3G,MAAM,OAAO,G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MAAiC;QACnF,MAAM,oBAAoB,GAAG,YAAY,CAAC,YAAY,IAAI,EAAE,CAAA;QAC5D,MAAM,mBAAmB,GAAG,oBAAoB,CAAC,MAAM,CACrD,CAAC,CAAc,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,MAAM,CAAC,gBAAgB,CAC7D,CAAA;QAED,MAAM,aAAa,GAAG,IAAA,qBAAY,EAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAElD,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,IAAI,EAAE,CAAA;QAC9C,yDAAyD;QACzD,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,CAC3C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,aAAa,CAAC,CACzE,CAAA;QAED,uCACK,YAAY,KACf,YAAY,EAAE,mBAAmB,EACjC,GAAG,EAAE,cAAc,IACpB;IACH,CAAC;CACF;AAxLD,sCAwLC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/datadog-ci-plugin-container-app",
3
- "version": "4.1.3",
3
+ "version": "4.2.0",
4
4
  "description": "Datadog CI plugin for `container-app` commands",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -35,13 +35,12 @@
35
35
  "prepack": "yarn package:clean-dist"
36
36
  },
37
37
  "peerDependencies": {
38
- "@datadog/datadog-ci-base": "4.1.3"
38
+ "@datadog/datadog-ci-base": "4.2.0"
39
39
  },
40
40
  "dependencies": {
41
41
  "@azure/arm-appcontainers": "^3.0.0",
42
42
  "@azure/arm-resources": "^6.1.0",
43
43
  "@azure/identity": "^4.10.1",
44
- "chalk": "3.0.0",
45
- "fast-deep-equal": "^3.1.3"
44
+ "chalk": "3.0.0"
46
45
  }
47
46
  }