Skip to content

Commit

Permalink
standardise labels/tags
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored and mergify-bot committed Apr 25, 2022
1 parent 738b239 commit 8201787
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
11 changes: 7 additions & 4 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
pipeline {
agent { label 'ubuntu-20 && immutable' }
environment {
BASE_DIR="src/github.com/elastic/integrations"
REPO = 'integrations'
BASE_DIR="src/github.com/elastic/${REPO}"
GITHUB_TOKEN_CREDENTIALS = "2a9602aa-ab9f-4e52-baf3-b71ca88469c7"
JOB_GIT_CREDENTIALS = "f6c7695a-671e-4f4f-a331-acdce44ff9ba"
PACKAGE_STORAGE_BASE_DIR = "src/github.com/elastic/package-storage"
Expand Down Expand Up @@ -258,9 +259,11 @@ def withCloudTestEnv(Closure body) {
[var: "AWS_SECRET_ACCESS_KEY", password: aws.secret_key],
])
withEnvMask(vars: maskedVars) {
withEnv(["TF_VAR_BUILD_ID=${BUILD_ID}",
"TF_VAR_BRANCH_NAME=${BRANCH_NAME}",
"TF_VAR_CREATED_DATE=${currentBuild.getRawBuild().getTimestampString2()}"]) {
withEnv(["TF_VAR_BRANCH_NAME_LOWER_CASE=${env.BRANCH_NAME.toLowerCase()}",
"TF_VAR_BUILD_ID=${BUILD_ID}",
"TF_VAR_CREATED_DATE=${new Date().getTime()}",
"TF_VAR_ENVIRONMENT=ci",
"TF_VAR_REPO=${env.REPO}"]) {
body()
}
}
Expand Down
10 changes: 5 additions & 5 deletions packages/aws/data_stream/ec2_metrics/_dev/deploy/tf/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ variable "TEST_RUN_ID" {
provider "aws" {
default_tags {
tags = {
Environment = "CI"
Owner = "integrations"
Branch = var.BRANCH_NAME
Build = var.BUILD_ID
CreatedDate = var.CREATED_DATE
environment = var.ENVIRONMENT
repo = var.REPO
branch = var.BRANCH
build = var.BUILD_ID
created_date = var.CREATED_DATE
}
}
}
Expand Down
18 changes: 13 additions & 5 deletions packages/aws/data_stream/ec2_metrics/_dev/deploy/tf/variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "BRANCH_NAME" {
description = "Branch name for tagging purposes"
default = "beats"
variable "BRANCH" {
description = "Branch name or pull request for tagging purposes"
default = "unknown-branch"
}

variable "BUILD_ID" {
Expand All @@ -9,6 +9,14 @@ variable "BUILD_ID" {
}

variable "CREATED_DATE" {
description = "Creation date for tagging purposes"
default = "unknown-build"
description = "Creation date in epoch time for tagging purposes"
default = "unknown-date"
}

variable "ENVIRONMENT" {
default = "unknown-environment"
}

variable "REPO" {
default = "unknown-repo-name"
}

0 comments on commit 8201787

Please sign in to comment.