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

[Filebeat] Integration tests in CI for AWS-S3 input #27491

Merged
merged 10 commits into from
Sep 6, 2021
Merged
9 changes: 6 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pipeline {
RUNBLD_DISABLE_NOTIFICATIONS = 'true'
SLACK_CHANNEL = "#beats-build"
SNAPSHOT = 'true'
TERRAFORM_VERSION = "0.12.30"
TERRAFORM_VERSION = "0.13.7"
XPACK_MODULE_PATTERN = '^x-pack\\/[a-z0-9]+beat\\/module\\/([^\\/]+)\\/.*'
}
options {
Expand Down Expand Up @@ -832,8 +832,10 @@ def withCloudTestEnv(Closure body) {
def maskedVars = []
def testTags = "${env.TEST_TAGS}"

// AWS
if (params.allCloudTests || params.awsCloudTests) {
// Allow AWS credentials when the build was configured to do so with:
// - the cloudtests build parameters
// - the aws github label
if (params.allCloudTests || params.awsCloudTests || matchesPrLabel(label: 'aws')) {
Comment on lines +835 to +838
Copy link
Member

@v1v v1v Sep 2, 2021

Choose a reason for hiding this comment

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

This should help to configure the AWS credentials when the aws github label was assigned to the Pull Request as explained in #27491 (comment)

testTags = "${testTags},aws"
def aws = getVaultSecret(secret: "${AWS_ACCOUNT_SECRET}").data
if (!aws.containsKey('access_key')) {
Expand Down Expand Up @@ -885,6 +887,7 @@ def startCloudTestEnv(Map args = [:]) {
// If it failed then cleanup without failing the build
sh(label: 'Terraform Cleanup', script: ".ci/scripts/terraform-cleanup.sh ${folder}", returnStatus: true)
}
error('startCloudTestEnv: terraform apply failed.')
Copy link
Member

Choose a reason for hiding this comment

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

Enforce the error is reported after the catch closure

} finally {
// Archive terraform states in case manual cleanup is needed.
archiveArtifacts(allowEmptyArchive: true, artifacts: '**/terraform.tfstate')
Expand Down
13 changes: 13 additions & 0 deletions x-pack/filebeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ stages:
platforms: ## override default labels in this specific stage.
- "windows-7"
stage: extended
cloud:
cloud: "mage build test"
withModule: true ## run the ITs only if the changeset affects a specific module.
dirs: ## apply terraform for the given directory.
- "x-pack/filebeat/input/awss3/_meta/terraform"
when: ## Override the top-level when.
parameters:
- "awsCloudTests"
comments:
- "/test x-pack/filebeat for aws cloud"
labels:
- "aws"
stage: extended
#windows-7-32: See https://github.com/elastic/beats/issues/22315
# mage: "mage build unitTest"
# platforms: ## override default labels in this specific stage.
Expand Down
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/aws/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ resource "aws_s3_bucket_object" "test" {
resource "aws_instance" "test" {
ami = data.aws_ami.latest-amzn.id
monitoring = true
instance_type = "t1.micro"
instance_type = "t2.micro"
tags = {
Name = "metricbeat-test"
}
Expand Down