Skip to content

Commit

Permalink
[8.x](backport #2648) Fix GCP Labeling in test environment workflow (#…
Browse files Browse the repository at this point in the history
…2650)

Fix GCP Labeling in test environment workflow (#2648)

(cherry picked from commit 29e90ed)

Co-authored-by: Dmitry Gurevich <99176494+gurevichdmitry@users.noreply.github.com>
  • Loading branch information
mergify[bot] and gurevichdmitry authored Oct 31, 2024
1 parent 4c7df7f commit f6aba3b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/test-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ env:
WORKING_DIR: deploy/test-environments
INTEGRATIONS_SETUP_DIR: tests/integrations_setup
AWS_DEFAULT_TAGS: "Key=division,Value=engineering Key=org,Value=security Key=team,Value=cloud-security-posture Key=project,Value=test-environments"
GCP_DEFAULT_TAGS: "division=engineering,org=security,team=cloud-security-posture,project=test-environments,owner=${{ github.actor }}"
GCP_ZONE: "us-central1-a"
AZURE_DEFAULT_TAGS: "division=engineering org=security team=cloud-security-posture project=test-environments owner=${{ github.actor }}"
TF_VAR_ec_api_key: ${{ secrets.EC_API_KEY }}
Expand Down Expand Up @@ -409,7 +408,14 @@ jobs:
- name: Deploy CSPM GCP agent
id: cspm-gcp-agent
working-directory: deploy/deployment-manager
env:
ACTOR: ${{ github.actor }}
run: |
# GCP labeling rules:
# Only hyphens (-), underscores (_), lowercase characters, and numbers are allowed. International characters are allowed.
# Convert github.actor to lowercase, replace disallowed characters
GCP_LABEL=$(echo "$ACTOR" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_-]/_/g')
GCP_DEFAULT_TAGS="division=engineering,org=security,team=cloud-security-posture,project=test-environments,owner=$GCP_LABEL"
. ./set_env.sh && ./deploy.sh && gcloud compute instances update "${DEPLOYMENT_NAME}" --update-labels "${GCP_DEFAULT_TAGS}" --zone="${GCP_ZONE}"
- name: Install CSPM Azure integration
Expand Down

0 comments on commit f6aba3b

Please sign in to comment.