Skip to content

Commit

Permalink
chore: Remove GITHUB_ENV in favor of GITHUB_OUTPUT (#4926)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellistarn authored Oct 25, 2023
1 parent f6d1a28 commit 93484b9
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 49 deletions.
9 changes: 5 additions & 4 deletions .github/actions/e2e/slack/notify/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ runs:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
- shell: bash
- id: get-run-name
shell: bash
run: |
if [[ ${{ github.event_name }} == "schedule" ]]; then
RUN_NAME="${{ inputs.suite }}-periodic"
Expand All @@ -26,14 +27,14 @@ runs:
fi
# Convert the RUN_NAME to all lowercase
echo RUN_NAME=${RUN_NAME,,} >> $GITHUB_ENV
echo RUN_NAME=${RUN_NAME,,} >> $GITHUB_OUTPUT
- uses: ./.github/actions/e2e/slack/send-message
if: ${{ job.status == 'success' }}
with:
url: ${{ inputs.url }}
message: ":white_check_mark: ${{ env.RUN_NAME }} (https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})"
message: ":white_check_mark: ${{ steps.get-run-name.outputs.RUN_NAME }} (https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})"
- uses: ./.github/actions/e2e/slack/send-message
if: ${{ job.status == 'failure' }}
with:
url: ${{ inputs.url }}
message: ":x: ${{ env.RUN_NAME }} (https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})"
message: ":x: ${{ steps.get-run-name.outputs.RUN_NAME }} (https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})"
5 changes: 3 additions & 2 deletions .github/workflows/codegen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_GIT_PUSH: true
- run: export APICodeGenUpdate=$((cat /tmp/codegen-updates && echo "APICodeGenUpdate=true" >> $GITHUB_ENV) || echo "false")
- id: detect-changes
run: cat /tmp/codegen-updates && echo APICodeGenUpdate=true >> $GITHUB_OUTPUT
- name: Create Pull Request
if: env.APICodeGenUpdate == 'true'
if: steps.detect-changes.outputs.APICodeGenUpdate == 'true'
uses: actions/github-script@v6
with:
script: |
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/e2e-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ jobs:
role-to-assume: arn:aws:iam::${{ vars.ACCOUNT_ID }}:role/${{ vars.ROLE_NAME }}
aws-region: ${{ inputs.region }}
role-duration-seconds: 21600
- name: generate cluster name
- id: 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 }}'
echo CLUSTER_NAME=$CLUSTER_NAME >> $GITHUB_OUTPUT
- name: create eks cluster '${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}'
uses: ./.github/actions/e2e/create-cluster
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ inputs.region }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
k8s_version: ${{ inputs.k8s_version }}
eksctl_version: ${{ inputs.eksctl_version }}
ip_family: IPv4 # Set the value to IPv6 if IPv6 suite, else IPv4
Expand All @@ -94,7 +94,7 @@ jobs:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.PROMETHEUS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
workspace_id: ${{ vars.WORKSPACE_ID }}
git_ref: ${{ inputs.from_git_ref }}
- name: install karpenter
Expand All @@ -105,18 +105,18 @@ jobs:
region: ${{ inputs.region }}
ecr_account_id: ${{ vars.ECR_ACCOUNT_ID }}
ecr_region: ${{ vars.ECR_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
git_ref: ${{ inputs.from_git_ref }}
- uses: actions/checkout@v4
with:
ref: ${{ inputs.to_git_ref }}
- name: upgrade eks cluster '${{ env.CLUSTER_NAME }}'
- name: upgrade eks cluster '${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}'
uses: ./.github/actions/e2e/create-cluster
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ inputs.region }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
k8s_version: ${{ inputs.k8s_version }}
eksctl_version: ${{ inputs.eksctl_version }}
ip_family: IPv4 # Set the value to IPv6 if IPv6 suite, else IPv4
Expand All @@ -127,7 +127,7 @@ jobs:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.PROMETHEUS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
workspace_id: ${{ vars.WORKSPACE_ID }}
git_ref: ${{ inputs.to_git_ref }}
- name: upgrade crds
Expand All @@ -136,7 +136,7 @@ jobs:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ inputs.region }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
git_ref: ${{ inputs.to_git_ref }}
- name: upgrade karpenter
uses: ./.github/actions/e2e/install-karpenter
Expand All @@ -146,12 +146,12 @@ jobs:
region: ${{ inputs.region }}
ecr_account_id: ${{ vars.ECR_ACCOUNT_ID }}
ecr_region: ${{ vars.ECR_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
git_ref: ${{ inputs.to_git_ref }}
- name: run the Upgrade test suite
run: |
aws eks update-kubeconfig --name ${{ env.CLUSTER_NAME }}
CLUSTER_NAME=${{ env.CLUSTER_NAME }} INTERRUPTION_QUEUE=${{ env.CLUSTER_NAME }} CLUSTER_ENDPOINT="$(aws eks describe-cluster --name ${{ env.CLUSTER_NAME }} --query "cluster.endpoint" --output text)" TEST_SUITE="Beta/Integration" make e2etests
aws eks update-kubeconfig --name ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
CLUSTER_NAME=${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }} INTERRUPTION_QUEUE=${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }} CLUSTER_ENDPOINT="$(aws eks describe-cluster --name ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }} --query "cluster.endpoint" --output text)" TEST_SUITE="Beta/Integration" make e2etests
- name: notify slack of success or failure
uses: ./.github/actions/e2e/slack/notify
if: (success() || failure()) && github.event_name != 'workflow_run' && github.event_name != 'conformance'
Expand All @@ -167,15 +167,15 @@ jobs:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ inputs.region }}
cluster_name: ${{ env.CLUSTER_NAME }}
- name: cleanup karpenter and cluster '${{ env.CLUSTER_NAME }}' resources
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
- name: cleanup karpenter and cluster '${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}' resources
uses: ./.github/actions/e2e/cleanup
if: always()
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ inputs.region }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
git_ref: ${{ inputs.to_git_ref }}
eksctl_version: ${{ inputs.eksctl_version }}
- if: always() && github.event_name == 'workflow_run'
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,18 @@ jobs:
run: |
# Creating jitter so that we can stagger cluster creation to avoid throttling
sleep $(( $RANDOM % 300 + 1 ))
- name: generate cluster name
- id: generate-cluster-name
run: |
CLUSTER_NAME=$(echo ${{ inputs.suite }}-$RANDOM$RANDOM | awk '{print tolower($0)}' | tr / -)
echo "Using cluster name \"$CLUSTER_NAME\""
echo CLUSTER_NAME=$CLUSTER_NAME >> $GITHUB_ENV
- name: create eks cluster '${{ env.CLUSTER_NAME }}'
echo CLUSTER_NAME=$CLUSTER_NAME >> $GITHUB_OUTPUT
- name: create eks cluster '${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}'
uses: ./.github/actions/e2e/create-cluster
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ inputs.region }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
k8s_version: ${{ inputs.k8s_version }}
eksctl_version: ${{ inputs.eksctl_version }}
ip_family: ${{ contains(inputs.suite, 'IPv6') && 'IPv6' || 'IPv4' }} # Set the value to IPv6 if IPv6 suite, else IPv4
Expand All @@ -122,7 +122,7 @@ jobs:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ vars.PROMETHEUS_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
workspace_id: ${{ vars.WORKSPACE_ID }}
git_ref: ${{ inputs.git_ref }}
- name: install karpenter
Expand All @@ -133,14 +133,14 @@ jobs:
region: ${{ inputs.region }}
ecr_account_id: ${{ vars.ECR_ACCOUNT_ID }}
ecr_region: ${{ vars.ECR_REGION }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
git_ref: ${{ inputs.git_ref }}
- name: run the ${{ inputs.suite }} test suite
run: |
aws eks update-kubeconfig --name ${{ env.CLUSTER_NAME }}
aws eks update-kubeconfig --name ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
TEST_SUITE="${{ inputs.suite }}" ENABLE_METRICS=${{ inputs.enable_metrics }} METRICS_REGION=${{ vars.TIMESTREAM_REGION }} GIT_REF="$(git rev-parse HEAD)" \
CLUSTER_NAME="${{ env.CLUSTER_NAME }}" CLUSTER_ENDPOINT="$(aws eks describe-cluster --name ${{ env.CLUSTER_NAME }} --query "cluster.endpoint" --output text)" \
INTERRUPTION_QUEUE="${{ env.CLUSTER_NAME }}" make e2etests
CLUSTER_NAME="${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}" CLUSTER_ENDPOINT="$(aws eks describe-cluster --name ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }} --query "cluster.endpoint" --output text)" \
INTERRUPTION_QUEUE="${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}" make e2etests
- name: notify slack of success or failure
uses: ./.github/actions/e2e/slack/notify
if: (success() || failure()) && github.event_name != 'workflow_run' && inputs.workflow_trigger != 'conformance'
Expand All @@ -156,15 +156,15 @@ jobs:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ inputs.region }}
cluster_name: ${{ env.CLUSTER_NAME }}
- name: cleanup karpenter and cluster '${{ env.CLUSTER_NAME }}' resources
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
- name: cleanup karpenter and cluster '${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}' resources
uses: ./.github/actions/e2e/cleanup
if: always()
with:
account_id: ${{ vars.ACCOUNT_ID }}
role: ${{ vars.ROLE_NAME }}
region: ${{ inputs.region }}
cluster_name: ${{ env.CLUSTER_NAME }}
cluster_name: ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
git_ref: ${{ inputs.git_ref }}
eksctl_version: ${{ inputs.eksctl_version }}
- if: always() && github.event_name == 'workflow_run'
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/pr-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,39 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/download-artifact
- name: Parse artifacts and assign GA environment variables
- id: metadata
run: |
pr_number=$(head -n 2 /tmp/artifacts/metadata.txt | tail -n 1)
pr_commit=$(tail -n 1 /tmp/artifacts/metadata.txt)
echo "PR_COMMIT=$pr_commit" >> $GITHUB_ENV
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
echo "PR_COMMIT=$pr_commit" >> $GITHUB_OUTPUT
echo "PR_NUMBER=$pr_number" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
ref: ${{ env.PR_COMMIT }}
ref: ${{ steps.metadata.outputs.PR_COMMIT }}
- uses: ./.github/actions/commit-status/start
with:
name: "${{ github.workflow }} / ${{ github.job }} (pull_request_review)"
git_ref: ${{ env.PR_COMMIT }}
git_ref: ${{ steps.metadata.outputs.PR_COMMIT }}
- uses: ./.github/actions/install-deps
- uses: aws-actions/[email protected]
with:
role-to-assume: 'arn:aws:iam::${{ vars.ECR_ACCOUNT_ID }}:role/${{ vars.ECR_SNAPSHOT_ROLE_NAME }}'
aws-region: ${{ vars.ECR_REGION }}
- run: make snapshot
env:
GH_PR_NUMBER: ${{env.PR_NUMBER}}
GH_PR_NUMBER: ${{steps.metadata.outputs.PR_NUMBER}}
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: `${{env.PR_NUMBER}}`,
issue_number: `${{steps.metadata.outputs.PR_NUMBER}}`,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Snapshot successfully published to `oci://${{ vars.ECR_ACCOUNT_ID }}.dkr.ecr.${{ vars.ECR_REGION }}.amazonaws.com/karpenter/snapshot/karpenter:v0-${{env.PR_COMMIT}}`.'
body: 'Snapshot successfully published to `oci://${{ vars.ECR_ACCOUNT_ID }}.dkr.ecr.${{ vars.ECR_REGION }}.amazonaws.com/karpenter/snapshot/karpenter:v0-${{steps.metadata.outputs.PR_COMMIT}}`.'
})
- if: always()
uses: ./.github/actions/commit-status/end
with:
name: "${{ github.workflow }} / ${{ github.job }} (pull_request_review)"
git_ref: ${{ env.PR_COMMIT }}
git_ref: ${{ steps.metadata.outputs.PR_COMMIT }}
12 changes: 6 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
prerelease: false
- name: Save commit tag to environment
- id: tag
run: |
TAG=$(git describe --tags --exact-match)
echo "TAG=${TAG}" >> $GITHUB_ENV
echo "TAG=${TAG}" >> $GITHUB_OUTPUT
- uses: ./.github/actions/install-deps
- uses: aws-actions/[email protected]
with:
Expand All @@ -36,19 +36,19 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
- name: Create PR
if: env.TAG != 'no tag'
if: steps.tag.outputs.TAG != 'no tag'
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'chore: Release ${{ env.TAG }}',
title: 'chore: Release ${{ steps.tag.outputs.TAG }}',
owner,
repo,
head: 'release-${{ env.TAG }}',
head: 'release-${{ steps.tag.outputs.TAG }}',
base: 'main',
body: [
'Stable Release Changes for ${{ env.TAG }}.',
'Stable Release Changes for ${{ steps.tag.outputs.TAG }}.',
'Please disregard this PR if it is for a patch release.',
'Please remove the branch after merging.',
'This PR is generated by [StableRelease](https://github.com/aws/karpenter/actions/workflows/stable-release.yml).'
Expand Down

0 comments on commit 93484b9

Please sign in to comment.