Skip to content

Commit

Permalink
test: Reference git_ref in action calls to allow testing updates to…
Browse files Browse the repository at this point in the history
… actions (#4072)
  • Loading branch information
jonathan-innis committed Jun 20, 2023
1 parent 1fef30f commit 0cb9a30
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 72 deletions.
6 changes: 4 additions & 2 deletions .github/actions/e2e/cleanup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ inputs:
cluster_name:
description: 'Name of the cluster to be launched by eksctl'
required: true
git_ref:
description: "The git commit, tag, or branch to check out. Requires a corresponding Karpenter snapshot release"
runs:
using: "composite"
steps:
Expand All @@ -24,8 +26,8 @@ runs:
role-duration-seconds: 21600
- uses: actions/checkout@v3
with:
path: "actions"
- uses: ./actions/.github/actions/e2e/install-eksctl
ref: ${{ inputs.git_ref }}
- uses: ./.github/actions/e2e/install-eksctl
- name: delete-cluster
shell: bash
run: |
Expand Down
18 changes: 7 additions & 11 deletions .github/actions/e2e/create-cluster/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ inputs:
description: "IP Family of the cluster. Valid values are IPv4 or IPv6"
required: false
default: "IPv4"
git_repo:
description: "The git repo can be used to run tests on a fork"
required: false
default: "aws/karpenter"
git_ref:
description: "The git commit, tag, or branch to check out. Requires a corresponding Karpenter snapshot release"
required: false
Expand All @@ -39,12 +35,8 @@ runs:
role-duration-seconds: 21600
- uses: actions/checkout@v3
with:
repository: ${{ inputs.git_repo }}
ref: ${{ inputs.git_ref }}
- uses: actions/checkout@v3
with:
path: "actions"
- uses: ./actions/.github/actions/e2e/install-eksctl
- uses: ./.github/actions/e2e/install-eksctl
- name: create iam policies
shell: bash
run: |
Expand All @@ -63,10 +55,14 @@ runs:
--template-file $CLOUDFORMATION_PATH \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides "ClusterName=${{ inputs.cluster_name }}"
- name: create cluster
- name: create or upgrade cluster
shell: bash
run: |
eksctl create cluster -f - <<EOF
# Create or Upgrade the cluster based on whether the cluster already exists
cmd="create"
eksctl get cluster --name $(params.cluster-name) && cmd="upgrade"
eksctl ${cmd} cluster -f - <<EOF
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
Expand Down
9 changes: 1 addition & 8 deletions .github/actions/e2e/install-karpenter/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ inputs:
cluster_name:
description: 'Name of the cluster to be launched by eksctl'
required: true
git_repo:
description: "The git repo can be used to run tests on a fork"
default: "aws/karpenter"
git_ref:
description: "The git commit, tag, or branch to check out. Requires a corresponding Karpenter snapshot release"
runs:
Expand All @@ -29,12 +26,8 @@ runs:
role-duration-seconds: 21600
- uses: actions/checkout@v3
with:
repository: ${{ inputs.git_repo }}
ref: ${{ inputs.git_ref }}
- uses: actions/checkout@v3
with:
path: "actions"
- uses: ./actions/.github/actions/e2e/install-helm
- uses: ./.github/actions/e2e/install-helm
- name: install-karpenter
shell: bash
run: |
Expand Down
8 changes: 5 additions & 3 deletions .github/actions/e2e/install-prometheus/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ inputs:
workspace_id:
description: "Id of the prometheus remote_write workspace"
required: true
git_ref:
description: "The git commit, tag, or branch to check out. Requires a corresponding Karpenter snapshot release"
runs:
using: "composite"
steps:
- uses: actions/checkout@v3
with:
path: "actions"
- uses: ./actions/.github/actions/e2e/install-helm
ref: ${{ inputs.git_ref }}
- uses: ./.github/actions/e2e/install-helm
- name: add prometheus repo
shell: bash
run: |
Expand All @@ -37,7 +39,7 @@ runs:
run: |
helm upgrade --install prometheus prometheus-community/kube-prometheus-stack \
-n prometheus --create-namespace \
-f ./actions/.github/actions/e2e/install-prometheus/values.yaml \
-f ./.github/actions/e2e/install-prometheus/values.yaml \
--set prometheus.prometheusSpec.remoteWrite[0].url=https://aps-workspaces.${{ inputs.region }}.amazonaws.com/workspaces/${{ inputs.workspace_id }}/api/v1/remote_write \
--set prometheus.prometheusSpec.remoteWrite[0].sigv4.region=${{ inputs.region }} \
--set prometheus.serviceAccount.annotations."eks\.amazonaws\.com/role-arn"="arn:aws:iam::${{ inputs.account_id }}:role/prometheus-irsa-${{ inputs.cluster_name }}"
8 changes: 5 additions & 3 deletions .github/actions/e2e/slack/notify/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ inputs:
url:
description: "Webhook URL to send the Slack notification to"
required: true
git_ref:
description: "The git commit, tag, or branch to check out. Requires a corresponding Karpenter snapshot release"
event_name:
description: "Type of event that triggered this test run"
required: true
Expand All @@ -17,7 +19,7 @@ runs:
steps:
- uses: actions/checkout@v3
with:
path: actions
ref: ${{ inputs.git_ref }}
- shell: bash
run: |
if [[ ! -z "${{ inputs.pr_number }}" ]]; then
Expand All @@ -30,12 +32,12 @@ runs:
# Convert the RUN_NAME to all lowercase
echo RUN_NAME=${RUN_NAME,,} >> $GITHUB_ENV
- uses: ./actions/.github/actions/e2e/slack/send-message
- uses: ./.github/actions/e2e/slack/send-message
if: ${{ job.status == 'success' }}
with:
url: ${{ inputs.url }}
message: ":white_check_mark: ${{ env.RUN_NAME }} tests succeeded (#${{ github.run_number }})"
- uses: ./actions/.github/actions/e2e/slack/send-message
- uses: ./.github/actions/e2e/slack/send-message
if: ${{ job.status == 'failure' }}
with:
url: ${{ inputs.url }}
Expand Down
7 changes: 0 additions & 7 deletions .github/actions/e2e/upgrade-crds/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ inputs:
cluster_name:
description: 'Name of the cluster to be launched by eksctl'
required: true
git_repo:
description: "The git repo can be used to run tests on a fork"
default: "aws/karpenter"
git_ref:
description: "The git commit, tag, or branch to check out. Requires a corresponding Karpenter snapshot release"
runs:
Expand All @@ -29,11 +26,7 @@ runs:
role-duration-seconds: 21600
- uses: actions/checkout@v3
with:
repository: ${{ inputs.git_repo }}
ref: ${{ inputs.git_ref }}
- uses: actions/checkout@v3
with:
path: "actions"
- name: install-karpenter
shell: bash
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
# Download the artifact and resolve the commit if initiated by PR snapshot
# Otherwise, use the currently checked-out branch to run the E2E tests against
- uses: actions/checkout@v3
with:
ref: ${{ inputs.git_ref }}
- if: github.event_name == 'workflow_run'
uses: ./.github/actions/download-artifact
- id: resolve-step
Expand All @@ -44,7 +46,6 @@ jobs:
uses: ./.github/workflows/e2e.yaml
with:
suite: ${{ matrix.suite }}
git_repo: aws/karpenter
git_ref: ${{ needs.resolve-git-ref.outputs.GIT_REF }}
pr_number: ${{ needs.resolve-git-ref.outputs.PR_NUM }}
event_name: ${{ github.event_name }}
Expand All @@ -55,8 +56,7 @@ jobs:
if: (github.repository == 'aws/karpenter' && (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success')) || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/e2e-upgrade.yaml
with:
git_repo: aws/karpenter
from_git_ref: v0.26.1
from_git_ref: v0.27.5
to_git_ref: ${{ needs.resolve-git-ref.outputs.GIT_REF }}
pr_number: ${{ needs.resolve-git-ref.outputs.PR_NUM }}
event_name: ${{ github.event_name }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/e2e-scale-trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
uses: ./.github/workflows/e2e.yaml
with:
suite: Scale
git_repo: aws/karpenter
event_name: ${{ github.event_name }}
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
51 changes: 32 additions & 19 deletions .github/workflows/e2e-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@ name: E2EUpgrade
on:
workflow_dispatch:
inputs:
git_repo:
type: string
default: "aws/karpenter"
from_git_ref:
type: string
required: true
to_git_ref:
type: string
workflow_call:
inputs:
git_repo:
type: string
default: "aws/karpenter"
from_git_ref:
type: string
required: true
Expand Down Expand Up @@ -43,82 +37,101 @@ jobs:
role-duration-seconds: 21600
- uses: actions/checkout@v3
with:
path: actions
ref: ${{ inputs.to_git_ref }}
- name: generate cluster name
run: |
CLUSTER_NAME="upgrade-$RANDOM$RANDOM"
echo "Using cluster name \"$CLUSTER_NAME\""
echo CLUSTER_NAME=$CLUSTER_NAME >> $GITHUB_ENV
- name: create eks cluster '${{ env.CLUSTER_NAME }}'
uses: ./actions/.github/actions/e2e/create-cluster
uses: ./.github/actions/e2e/create-cluster
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.AWS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
kubernetes_version: ${{ vars.K8S_VERSION }}
ip_family: IPv4 # Set the value to IPv6 if IPv6 suite, else IPv4
git_repo: ${{ inputs.git_repo }}
git_ref: ${{ inputs.from_git_ref }}
- name: install prometheus
uses: ./actions/.github/actions/e2e/install-prometheus
uses: ./.github/actions/e2e/install-prometheus
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.AWS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
workspace_id: ${{ vars.WORKSPACE_ID }}
git_ref: ${{ inputs.from_git_ref }}
- name: install karpenter
uses: ./actions/.github/actions/e2e/install-karpenter
uses: ./.github/actions/e2e/install-karpenter
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.AWS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
git_repo: ${{ inputs.git_repo }}
git_ref: ${{ inputs.from_git_ref }}
- name: upgrade eks cluster '${{ env.CLUSTER_NAME }}'
uses: ./.github/actions/e2e/create-cluster
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.AWS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
kubernetes_version: ${{ vars.K8S_VERSION }}
ip_family: IPv4 # Set the value to IPv6 if IPv6 suite, else IPv4
git_ref: ${{ inputs.to_git_ref }}
- name: upgrade prometheus
uses: ./.github/actions/e2e/install-prometheus
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.AWS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
workspace_id: ${{ vars.WORKSPACE_ID }}
git_ref: ${{ inputs.to_git_ref }}
- name: upgrade crds
uses: ./actions/.github/actions/e2e/upgrade-crds
uses: ./.github/actions/e2e/upgrade-crds
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.AWS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
git_repo: ${{ inputs.git_repo }}
git_ref: ${{ inputs.to_git_ref }}
- name: upgrade karpenter
uses: ./actions/.github/actions/e2e/install-karpenter
uses: ./.github/actions/e2e/install-karpenter
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.AWS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
git_repo: ${{ inputs.git_repo }}
git_ref: ${{ inputs.to_git_ref }}
- name: run the Upgrade test suite
run: |
aws eks update-kubeconfig --name ${{ env.CLUSTER_NAME }}
TEST_SUITE="Integration" make e2etests
- name: notify slack of success or failure
uses: ./actions/.github/actions/e2e/slack/notify
uses: ./.github/actions/e2e/slack/notify
if: success() || failure()
with:
url: ${{ secrets.SLACK_WEBHOOK_URL }}
suite: Upgrade
pr_number: ${{ inputs.pr_number }}
event_name: ${{ inputs.event_name }}
git_ref: ${{ inputs.to_git_ref }}
- name: dump logs on failure
uses: ./actions/.github/actions/e2e/dump-logs
uses: ./.github/actions/e2e/dump-logs
if: failure() || cancelled()
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.AWS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
- name: cleanup karpenter and cluster '${{ env.CLUSTER_NAME }}' resources
uses: ./actions/.github/actions/e2e/cleanup
uses: ./.github/actions/e2e/cleanup
if: always()
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.AWS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
git_ref: ${{ inputs.to_git_ref }}

0 comments on commit 0cb9a30

Please sign in to comment.