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

Buildkite pipeline for acceptance tests #741

Merged
merged 8 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
8 changes: 8 additions & 0 deletions .buildkite/acceptance.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail

echo "--- Download dependencies"
make vendor

echo "--- Run acceptance tests"
EC_API_KEY=$TERRAFORM_PROVIDER_API_KEY_SECRET make testacc
15 changes: 15 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -euo pipefail

#Mimic Jenkins behavior during the migration
export BUILD_ID=$BUILDKITE_BUILD_ID

VAULT_PATH=secret/ci/elastic-terraform-provider-ec/terraform-provider-secrets

# Secrets must be redacted
# https://buildkite.com/docs/pipelines/managing-log-output#redacted-environment-variables

if [[ "$BUILDKITE_PIPELINE_SLUG" == "terraform-provider-ec" ]]; then
export TERRAFORM_PROVIDER_API_KEY_SECRET=$(scripts/retry.sh 5 vault kv get -field apikey ${VAULT_PATH})
fi
9 changes: 9 additions & 0 deletions .buildkite/hooks/pre-exit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -euo pipefail

if [[ "$BUILDKITE_STEP_KEY" == "acceptance-tests" ]]; then
echo "--- Sweeps any deployments older than 1h."
EC_API_KEY=$TERRAFORM_PROVIDER_API_KEY_SECRET SWEEPARGS=-sweep-run=ec_deployments make sweep
rm -rf reports bin
fi
8 changes: 6 additions & 2 deletions .buildkite/pipeline.yml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
steps:
- label: ":wave: Greetings"
command: "echo 'My first pipeline!'"
- label: ":test_tube: Acceptance tests"
command: .buildkite/acceptance.sh
agents:
image: "docker.io/library/golang:1.21"
cpu: "8"
memory: "4G"
17 changes: 14 additions & 3 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: buildkite-pipeline-terraform-provider-ec
description: Buildkite Pipeline for terraform-provider-ec
name: buildkite-pipeline-terraform-provider-ec-acceptance
description: Buildkite Pipeline for terraform-provider-ec acceptance tests
links:
- title: Pipeline
url: https://buildkite.com/elastic/terraform-provider-ec
Expand All @@ -17,7 +17,18 @@ spec:
apiVersion: buildkite.elastic.dev/v1
kind: Pipeline
metadata:
name: terraform-provider-ec
name: terraform-provider-ec-acceptance
spec:
repository: elastic/terraform-provider-ec
pipeline_file: ".buildkite/pipeline.yml"
teams:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The below team perms mirror the current GitHub permissions on the repository - this is also reflected in the GH repository RE : https://github.com/elastic/catalog-info/pull/635

control-plane-stateful:
access_level: MANAGE_BUILD_AND_READ
cloud-applications-es:
access_level: MANAGE_BUILD_AND_READ
cloud-applications-solutions:
access_level: MANAGE_BUILD_AND_READ
platform-writers:
access_level: BUILD_AND_READ
everyone:
access_level: READ_ONLY
Loading