Skip to content

Commit

Permalink
Adding helper file
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosrodlop committed Aug 11, 2024
1 parent 5351a04 commit 38c4a2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .cloudbees/workflows/bp-tf-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ jobs:
uses: docker://public.ecr.aws/r1n1q0e5/cloudbees-labs/tf-aws-cb-ci-eks-addon-agent:latest
shell: bash
run: |
set -x
aws s3api create-bucket \
--bucket ${{ env.BUCKET_NAME_TF_STATE }} \
--region ${{ env.AWS_REGION_TF_BUCKET }} || echo "Bucket ${{ env.BUCKET_NAME_TF_STATE }} already exists"
source blueprints/helpers.sh && s3-create-bucket ${{ env.BUCKET_NAME_TF_STATE }} ${{ env.AWS_REGION_TF_BUCKET }}
bp02:
env:
Expand Down
13 changes: 13 additions & 0 deletions .cloudbees/workflows/helpers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# Copyright (c) CloudBees, Inc.

set -euox pipefail

s3-create-bucket() {
local bucket_name=$1
local region=$2
aws s3api create-bucket \
--bucket "$bucket_name" \
--region "$region" || echo "$bucket_name already exists"
}

0 comments on commit 38c4a2e

Please sign in to comment.