Skip to content

Commit

Permalink
Merge pull request #245 from engedaam/add_git_ref_to_stack_when_no_ref
Browse files Browse the repository at this point in the history
Add git_ref for no ref is mentioned
  • Loading branch information
engedaam authored Dec 14, 2023
2 parents 47c82ea + 30d4fbd commit fc5b1ba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
18 changes: 15 additions & 3 deletions .github/actions/e2e/setup-cluster/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ runs:
PRIVATE_CLUSTER: ${{ inputs.private_cluster }}
GIT_REF: ${{ inputs.git_ref }}
run: |
if [[ "$GIT_REF" == '' ]]; then
REF=$(git rev-parse --short "$GITHUB_SHA")
else
REF=$GIT_REF
fi
echo "$REF"
# Create or Upgrade the cluster based on whether the cluster already exists
cmd="create"
eksctl get cluster --name "$CLUSTER_NAME" && cmd="upgrade"
Expand All @@ -99,7 +105,7 @@ runs:
github.com/run-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
testing/type: "e2e"
testing/cluster: "$CLUSTER_NAME"
test/git_ref: "$GIT_REF"
test/git_ref: "$REF"
kubernetesNetworkConfig:
ipFamily: "$IP_FAMILY"
managedNodeGroups:
Expand Down Expand Up @@ -188,12 +194,18 @@ runs:
env:
ACCOUNT_ID: ${{ inputs.account_id }}
CLUSTER_NAME: ${{ inputs.cluster_name }}
GIT_REF: ${{ inputs.git_ref }}
GIT_REF: ${{ inputs.git_ref }}
run: |
if [[ "$GIT_REF" == '' ]]; then
REF=$(git rev-parse --short "$GITHUB_SHA")
else
REF=$GIT_REF
fi
echo "$REF"
oidc_id=$(aws eks describe-cluster --name "$CLUSTER_NAME" --query "cluster.identity.oidc.issuer" --output text | cut -d '/' -f 3,4,5)
arn="arn:aws:iam::$ACCOUNT_ID:oidc-provider/${oidc_id}"
aws iam tag-open-id-connect-provider --open-id-connect-provider-arn $arn \
--tags Key=test/git_ref,Values="$GIT_REF" Key=testing/type,Value=e2e Key=testing/cluster,Value=$CLUSTER_NAME Key=github.com/run-url,Value=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
--tags Key=test/git_ref,Values="$REF" Key=testing/type,Value=e2e Key=testing/cluster,Value=$CLUSTER_NAME Key=github.com/run-url,Value=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: give KarpenterNodeRole permission to bootstrap
shell: bash
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ jobs:
role-to-assume: arn:aws:iam::${{ vars.CI_ACCOUNT_ID }}:role/${{ vars.CI_ROLE_NAME }}
aws-region: ${{ inputs.region }}
role-duration-seconds: 21600
- name: add jitter on cluster setup
run: |
# Creating jitter so that we can stagger cluster creation to avoid throttling
sleep $(( RANDOM % 300 + 1 ))
# - name: add jitter on cluster setup
# run: |
# # Creating jitter so that we can stagger cluster creation to avoid throttling
# sleep $(( RANDOM % 300 + 1 ))
- id: generate-cluster-name
name: generate cluster name
env:
Expand Down

0 comments on commit fc5b1ba

Please sign in to comment.