Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add git commit details to stress environment #7543

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you want -C here do you? When I tried that locally I don't think it worked. I thought that was referring to the configuration location.

if (!$LASTEXITCODE) {
$helmCommandArg += "--set", "GitCommit=$gitCommit"
}

if ($LockDeletionForDays) {
$date = (Get-Date).AddDays($LockDeletionForDays).ToUniversalTime()
Expand Down
17 changes: 14 additions & 3 deletions tools/stress-cluster/chaos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -29,6 +30,7 @@ spec:
labels:
release: {{ .Release.Name }}
scenario: {{ .Stress.Scenario }}
gitCommit: {{ .Values.GitCommit | default "" }}
{{- if .Values.PodDisruptionBudgetExpiry }}
annotations:
deletionLockExpiry: {{ .Values.PodDisruptionBudgetExpiry }}
Expand Down Expand Up @@ -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 }}
Expand All @@ -95,6 +98,7 @@ spec:
labels:
release: {{ .Release.Name }}
scenario: {{ .Stress.Scenario }}
gitCommit: {{ .Values.GitCommit | default "" }}
{{- if .Values.PodDisruptionBudgetExpiry }}
annotations:
deletionLockExpiry: {{ .Values.PodDisruptionBudgetExpiry }}
Expand Down