Add git commit details to stress environment (#7543)

This commit is contained in:
Ben Broderick Phillips 2024-01-18 17:01:21 -05:00 коммит произвёл GitHub
Родитель 1a4819df7f
Коммит 460152dd18
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
12 изменённых файлов: 66 добавлений и 23 удалений

Просмотреть файл

@ -321,7 +321,18 @@ function DeployStressPackage(
$generatedConfigPath = Join-Path $pkg.Directory generatedValues.yaml
$subCommand = $Template ? "template" : "upgrade"
$subCommandFlag = $Template ? "--debug" : "--install"
$helmCommandArg = "helm", $subCommand, $releaseName, $pkg.Directory, "-n", $pkg.Namespace, $subCommandFlag, "--values", $generatedConfigPath, "--set", "stress-test-addons.env=$environment"
$helmCommandArg = @(
"helm", $subCommand, $releaseName, $pkg.Directory,
"-n", $pkg.Namespace,
$subCommandFlag,
"--values", $generatedConfigPath,
"--set", "stress-test-addons.env=$environment"
)
$gitCommit = git -C $pkg.Directory rev-parse HEAD 2>&1
if (!$LASTEXITCODE) {
$helmCommandArg += "--set", "GitCommit=$gitCommit"
}
if ($LockDeletionForDays) {
$date = (Get-Date).AddDays($LockDeletionForDays).ToUniversalTime()

Просмотреть файл

@ -10,7 +10,7 @@ The chaos environment is an AKS cluster (Azure Kubernetes Service) with several
* [Creating a Stress Test](#creating-a-stress-test)
* [Layout](#layout)
* [Stress Test Metadata](#stress-test-metadata)
* [Stress Test Secrets](#stress-test-secrets)
* [Stress Test Secrets and Environment](#stress-test-secrets-and-environment)
* [Stress Test File Share](#stress-test-file-share)
* [Stress Test Azure Resources](#stress-test-azure-resources)
* [Deploying to a Custom Subscription](#deploying-to-a-custom-subscription)
@ -181,7 +181,7 @@ Fields in `Chart.yaml`
1. Extra fields in `annotations` can be set arbitrarily, and used via the `-Filters` argument to the [stress test deploy
script](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/scripts/stress-testing/deploy-stress-tests.ps1).
### Stress Test Secrets
### Stress Test Secrets and Environment
For ease of implementation regarding merging secrets from various Keyvault sources, secret values injected into the stress
test container can be found in a file at path `$ENV_FILE` (usually `/mnt/outputs/.env`). This file follows the "dotenv" file syntax (i.e. lines of <key>=<value>), and
@ -209,6 +209,16 @@ APPINSIGHTS_INSTRUMENTATIONKEY=<value>
RESOURCE_GROUP=<value>
```
Additionally, several values are made available as environment variables via the `stress-test-addons.container-env` template (see [job manifest](#job-manifest)):
- `GIT_COMMIT` - Matches the git commit of the repository in which the stress test was deployed from. Useful for telemetry queries.
- `ENV_FILE` - Path to the env file that can be dot sourced to load deployment and other secrets.
- `SCENARIO_NAME` - The identifier for the specific test config instance from the scenario matrix.
- `POD_NAME` - The name of the host pod, useful for custom telemetry.
- `POD_NAMESPACE` - The kubernetes namespace the container is running in, useful for custom telemetry.
- `DEBUG_SHARE` - See [stress test file share](#stress-test-file-share)
- `DEBUG_SHARE_ROOT` - See [stress test file share](#stress-test-file-share)
### Stress Test File Share
Stress tests are encouraged to use app insights logs and metrics as much as possible for diagnostics. However there
@ -436,7 +446,8 @@ a little bit earlier than pods > 0.
#### Built-In Labels
- `chaos` - set this to "true" to enable chaos for your pod
- `Skip.RemoveTestResources` set this to "true" to prevent resources from being deleted immediately after test completion
- `Skip.RemoveTestResources` - set this to "true" to prevent resources from being deleted immediately after test completion
- `gitCommit` - this will be automatically set on pod and job labels based on the repository commit the stress test was deployed from. Useful for telemetry queries.
### Chaos Manifest

Просмотреть файл

@ -1,6 +1,6 @@
dependencies:
- name: stress-test-addons
repository: https://stresstestcharts.blob.core.windows.net/helm/
version: 0.3.0
digest: sha256:3e21a7fdf5d6b37e871a6dd9f755888166fbb24802aa517f51d1d9223b47656e
generated: "2023-09-22T16:52:50.685996842-04:00"
version: 0.3.1
digest: sha256:28e374f8db5c46447b2a1491d4361ceb126536c425cbe54be49017120fe7b27d
generated: "2024-01-17T15:38:17.871619598-05:00"

Просмотреть файл

@ -1,6 +1,6 @@
dependencies:
- name: stress-test-addons
repository: https://stresstestcharts.blob.core.windows.net/helm/
version: 0.3.0
digest: sha256:3e21a7fdf5d6b37e871a6dd9f755888166fbb24802aa517f51d1d9223b47656e
generated: "2023-09-22T16:52:15.852268131-04:00"
version: 0.3.1
digest: sha256:28e374f8db5c46447b2a1491d4361ceb126536c425cbe54be49017120fe7b27d
generated: "2024-01-17T15:39:38.364921715-05:00"

Просмотреть файл

@ -1,6 +1,6 @@
dependencies:
- name: stress-test-addons
repository: https://stresstestcharts.blob.core.windows.net/helm/
version: 0.3.0
digest: sha256:3e21a7fdf5d6b37e871a6dd9f755888166fbb24802aa517f51d1d9223b47656e
generated: "2023-09-22T16:53:05.807496743-04:00"
version: 0.3.1
digest: sha256:28e374f8db5c46447b2a1491d4361ceb126536c425cbe54be49017120fe7b27d
generated: "2024-01-17T15:40:00.504665427-05:00"

Просмотреть файл

@ -1,6 +1,6 @@
dependencies:
- name: stress-test-addons
repository: https://stresstestcharts.blob.core.windows.net/helm/
version: 0.3.0
digest: sha256:3e21a7fdf5d6b37e871a6dd9f755888166fbb24802aa517f51d1d9223b47656e
generated: "2023-09-22T16:52:39.169191153-04:00"
version: 0.3.1
digest: sha256:28e374f8db5c46447b2a1491d4361ceb126536c425cbe54be49017120fe7b27d
generated: "2024-01-17T15:39:47.856708817-05:00"

Просмотреть файл

@ -1,6 +1,6 @@
dependencies:
- name: stress-test-addons
repository: https://stresstestcharts.blob.core.windows.net/helm/
version: 0.3.0
digest: sha256:3e21a7fdf5d6b37e871a6dd9f755888166fbb24802aa517f51d1d9223b47656e
generated: "2023-09-22T16:51:57.085186425-04:00"
version: 0.3.1
digest: sha256:28e374f8db5c46447b2a1491d4361ceb126536c425cbe54be49017120fe7b27d
generated: "2024-01-17T15:39:23.757382734-05:00"

Просмотреть файл

@ -1,5 +1,11 @@
# Release History
## 0.3.1 (2024-01-17)
### Features Added
Add `GIT_COMMIT` to container environment and `gitCommit` to job/pod labels. The value corresponds to the git commit of the stress test being deployed if it's in a git repository.
## 0.3.0 (2023-09-22)
### Breaking Changes

Просмотреть файл

@ -2,5 +2,5 @@ apiVersion: v2
name: stress-test-addons
description: Baseline resources and templates for stress testing clusters
version: 0.3.0
version: 0.3.1
appVersion: v0.1

Просмотреть файл

@ -3,9 +3,18 @@ entries:
stress-test-addons:
- apiVersion: v2
appVersion: v0.1
created: "2023-09-22T16:48:47.835082288-04:00"
created: "2024-01-17T15:37:50.337580687-05:00"
description: Baseline resources and templates for stress testing clusters
digest: 73d86e156b1f87d556ef3d51d048bb55f3f864867c9a422f0fd67bbc36a14c11
digest: 8a5f3c3089fcdea4b34a99b143f76fca56c66ca15601615d6abc3d90bd166a36
name: stress-test-addons
urls:
- https://stresstestcharts.blob.core.windows.net/helm/stress-test-addons-0.3.1.tgz
version: 0.3.1
- apiVersion: v2
appVersion: v0.1
created: "2024-01-17T15:37:32.776747999-05:00"
description: Baseline resources and templates for stress testing clusters
digest: 78831646bb45d6363c1da002a4a7024c83a892a9a1f1d80b7c1ef1992ceb4830
name: stress-test-addons
urls:
- https://stresstestcharts.blob.core.windows.net/helm/stress-test-addons-0.3.0.tgz
@ -199,4 +208,4 @@ entries:
urls:
- https://stresstestcharts.blob.core.windows.net/helm/stress-test-addons-0.1.2.tgz
version: 0.1.2
generated: "2023-09-22T16:48:47.827726695-04:00"
generated: "2024-01-17T15:37:50.322863305-05:00"

Просмотреть файл

@ -16,6 +16,8 @@ env:
value: /mnt/share/
- name: SCENARIO_NAME
value: {{ .Stress.Scenario }}
- name: GIT_COMMIT
value: {{ .Values.GitCommit | default "" }}
volumeMounts:
- name: test-env-{{ lower .Stress.Scenario }}-{{ .Release.Name }}-{{ .Release.Revision }}
mountPath: /mnt/outputs

Просмотреть файл

@ -17,6 +17,7 @@ metadata:
scenario: {{ .Stress.Scenario }}
resourceGroupName: {{ .Stress.ResourceGroupName }}
baseName: {{ .Stress.BaseName }}
gitCommit: {{ .Values.GitCommit | default "" }}
spec:
{{- if .Stress.parallel }}
completions: {{ .Stress.parallel }}
@ -29,6 +30,7 @@ spec:
labels:
release: {{ .Release.Name }}
scenario: {{ .Stress.Scenario }}
gitCommit: {{ .Values.GitCommit | default "" }}
{{- if .Values.PodDisruptionBudgetExpiry }}
annotations:
deletionLockExpiry: {{ .Values.PodDisruptionBudgetExpiry }}
@ -83,6 +85,7 @@ metadata:
scenario: {{ .Stress.Scenario }}
resourceGroupName: {{ .Stress.ResourceGroupName }}
baseName: {{ .Stress.BaseName }}
gitCommit: {{ .Values.GitCommit | default "" }}
spec:
{{- if .Stress.parallel }}
completions: {{ .Stress.parallel }}
@ -95,6 +98,7 @@ spec:
labels:
release: {{ .Release.Name }}
scenario: {{ .Stress.Scenario }}
gitCommit: {{ .Values.GitCommit | default "" }}
{{- if .Values.PodDisruptionBudgetExpiry }}
annotations:
deletionLockExpiry: {{ .Values.PodDisruptionBudgetExpiry }}