Skip to content
Open
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
14 changes: 6 additions & 8 deletions .evergreen-functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ variables:
- RELEASE_INITIAL_VERSION
- RELEASE_INITIAL_COMMIT_SHA
- RELEASE_OPERATOR_VERSION
- MDB_BASH_DEBUG

functions:

Expand Down Expand Up @@ -249,7 +250,7 @@ functions:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
command: scripts/dev/setup_chart_testing_cli.sh
command: scripts/dev/setup_chart_testing_cli.sh

lint_repo:
- command: subprocess.exec
Expand Down Expand Up @@ -787,18 +788,14 @@ functions:
#
# Code snippet test automation
#

sample_commit_output:
- command: github.generate_token
params:
expansion_name: GH_TOKEN
archive_snippets_output:
- command: subprocess.exec
params:
include_expansions_in_env:
- GH_TOKEN
- code_snippets_commit_output
- MDB_BASH_DEBUG
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/code_snippets/sample_commit_output.sh
binary: scripts/code_snippets/archive_snippets_output.sh

# it executes a script by convention: ./scripts/code_snippets/tests/${task_name}
test_code_snippets:
Expand All @@ -812,6 +809,7 @@ functions:
- code_snippets_teardown
- code_snippets_reset
- task_name
- MDB_BASH_DEBUG
script: |
./scripts/code_snippets/tests/${task_name}

Expand Down
28 changes: 7 additions & 21 deletions .evergreen-snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,33 +64,19 @@ functions:
permissions: private
visibility: signed
content_type: text/plain
- command: s3.put
params:
aws_key: ${enterprise_aws_access_key_id}
aws_secret: ${enterprise_aws_secret_access_key}
local_files_include_filter:
- src/github.com/mongodb/mongodb-kubernetes/public/architectures/**/*.out
- src/github.com/mongodb/mongodb-kubernetes/docs/**/*.out
preserve_path: true
remote_file: logs/${task_id}/${execution}/
bucket: operator-e2e-artifacts
permissions: private
visibility: signed
content_type: text/plain

upload_code_snippets_outputs:
- command: s3.put
params:
aws_key: ${enterprise_aws_access_key_id}
aws_secret: ${enterprise_aws_secret_access_key}
local_files_include_filter:
- snippets_outputs.tgz
remote_file: logs/${task_id}/${execution}/
- snippets_outputs*.tgz
remote_file: snippets_outputs/${version_id}
bucket: operator-e2e-artifacts
permissions: private
visibility: signed
content_type: ${content_type|application/x-gzip}
display_name: "Snippets Outputs"

tasks:
# Code snippets tasks
Expand All @@ -101,31 +87,31 @@ tasks:
tags: [ "code_snippets" ]
commands:
- func: test_code_snippets
- func: sample_commit_output
- func: archive_snippets_output

- name: test_gke_multi_cluster_no_mesh_snippets.sh
tags: [ "code_snippets" ]
commands:
- func: test_code_snippets
- func: sample_commit_output
- func: archive_snippets_output

- name: test_kind_search_community_snippets.sh
tags: [ "code_snippets", "patch-run" ]
commands:
- func: test_code_snippets
- func: sample_commit_output
- func: archive_snippets_output

- name: test_kind_search_enterprise_snippets.sh
tags: [ "code_snippets", "patch-run" ]
commands:
- func: test_code_snippets
- func: sample_commit_output
- func: archive_snippets_output

- name: test_kind_search_external_mongod_snippets.sh
tags: [ "code_snippets", "patch-run" ]
commands:
- func: test_code_snippets
- func: sample_commit_output
- func: archive_snippets_output

task_groups:
- name: gke_code_snippets_task_group
Expand Down
8 changes: 4 additions & 4 deletions .evergreen-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,25 @@ tasks:
tags: [ "code_snippets" ]
commands:
- func: test_code_snippets
- func: sample_commit_output
- func: archive_snippets_output

- name: task_gke_multi_cluster_no_mesh_snippets
tags: [ "code_snippets" ]
commands:
- func: test_code_snippets
- func: sample_commit_output
- func: archive_snippets_output

- name: task_kind_search_community_snippets
tags: [ "code_snippets", "patch-run" ]
commands:
- func: test_code_snippets
- func: sample_commit_output
- func: archive_snippets_output

- name: task_kind_search_enterprise_snippets
tags: [ "code_snippets", "patch-run" ]
commands:
- func: test_code_snippets
- func: sample_commit_output
- func: archive_snippets_output

## Below are only e2e runs for .evergreen.yml ##

Expand Down
6 changes: 3 additions & 3 deletions .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ parameters:
value: "false"
description: set this to true if you would like to delete the resources created in the code snippet tests, but keep the clusters

- key: code_snippets_commit_output
value: "false"
description: set this to true if you would like the pipeline to automatically push a branch with updated snippets outputs
- key: MDB_BASH_DEBUG
value: "0"
description: set this to 1 if you want shell scripts to enable set -x

# Each variant needs to be tagged with one or more tags referencing related build scenario:
# - pr_patch: for patches created by GitHub PRs
Expand Down
25 changes: 25 additions & 0 deletions scripts/code_snippets/archive_snippets_output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

set -eou pipefail
test "${MDB_BASH_DEBUG:-0}" -eq 1 && set -x

source scripts/dev/set_env_context.sh

# task_name is available from evergreen expansions and its set to the snippets test name (see tasks in .evergreen-snippets.yml)
test_name=${task_name:?}
test_name=${test_name%.sh}
patch_id=${version_id:?}

# to run it locally:
# $ test_name=test_kind_search_enterprise_snippets.sh archive_snippets_output.sh

output_dir="scripts/code_snippets/tests/outputs/${test_name}"
if [[ ! -d "${output_dir}" ]]; then
echo "Output dir is missing: ${output_dir}"
exit 1
fi

file_name="snippets_outputs_${patch_id}_${test_name}.tgz"
tar -cvzf "${file_name}" "${output_dir}"

echo "Collected snippets outputs from ${test_name} into ${file_name}"
21 changes: 0 additions & 21 deletions scripts/code_snippets/sample_commit_output.sh

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading