-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update gh to ado sync workflow to use service principals (#1363) * Make env configurable (#1046) Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com> * Adding test AKS workflow to v0.32 (#1052) * Run functional tests every 2 hours and add another workflow that runs… (#1020) * Run functional tests every 2 hours and add another workflow that runs the tests on AKS instead of k3d Signed-off-by: ytimocin <ytimocin@microsoft.com> * Triggering workflow Signed-off-by: ytimocin <ytimocin@microsoft.com> --------- Signed-off-by: ytimocin <ytimocin@microsoft.com> * Removing the run of the AKS workflow on PRs (#1051) Signed-off-by: ytimocin <ytimocin@microsoft.com> * Update the timeout (30s) for Playwright Signed-off-by: ytimocin <ytimocin@microsoft.com> --------- Signed-off-by: ytimocin <ytimocin@microsoft.com> * Use retry and update eshop playwright tests to wait for the catalog to appear (#1213) Signed-off-by: ytimocin <ytimocin@microsoft.com> * update gh to ado sync workflow to use service principals Signed-off-by: Will Tsai <28876888+willtsai@users.noreply.github.com> --------- Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com> Signed-off-by: ytimocin <ytimocin@microsoft.com> Signed-off-by: Will Tsai <28876888+willtsai@users.noreply.github.com> Signed-off-by: Will <28876888+willtsai@users.noreply.github.com> Co-authored-by: Reshma Abdul Rahim <61033581+Reshrahim@users.noreply.github.com> Co-authored-by: Yetkin Timocin <ytimocin@microsoft.com> Signed-off-by: sk593 <shruthikumar@microsoft.com> * Workflow and playwright test updates (#1360) Signed-off-by: ytimocin <ytimocin@microsoft.com> Signed-off-by: sk593 <shruthikumar@microsoft.com> * Changing the place of page.reload in the tests (#1492) Signed-off-by: ytimocin <ytimocin@microsoft.com> Signed-off-by: sk593 <shruthikumar@microsoft.com> * Adding a job that will purge AWS EKS clusters every 6 hours (#1462) Signed-off-by: ytimocin <ytimocin@microsoft.com> Signed-off-by: sk593 <shruthikumar@microsoft.com> * Update all deps of all apps (#1536) Signed-off-by: ytimocin <ytimocin@microsoft.com> Signed-off-by: sk593 <shruthikumar@microsoft.com> * Updating the runner of purge azure test resources workflow (#1537) Signed-off-by: ytimocin <ytimocin@microsoft.com> Signed-off-by: sk593 <shruthikumar@microsoft.com> * Update purget test resources to fix the workflow failures (#1552) Signed-off-by: ytimocin <ytimocin@microsoft.com> Signed-off-by: sk593 <shruthikumar@microsoft.com> * Fixing the eShop catalog load issue for the UI tests (#1548) Signed-off-by: ytimocin <ytimocin@microsoft.com> Signed-off-by: sk593 <shruthikumar@microsoft.com> --------- Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com> Signed-off-by: ytimocin <ytimocin@microsoft.com> Signed-off-by: Will Tsai <28876888+willtsai@users.noreply.github.com> Signed-off-by: Will <28876888+willtsai@users.noreply.github.com> Signed-off-by: sk593 <shruthikumar@microsoft.com> Co-authored-by: Will <28876888+willtsai@users.noreply.github.com> Co-authored-by: Reshma Abdul Rahim <61033581+Reshrahim@users.noreply.github.com> Co-authored-by: Yetkin Timocin <ytimocin@microsoft.com>
- Loading branch information
1 parent
6949da2
commit b9018d4
Showing
32 changed files
with
21,566 additions
and
15,119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# ------------------------------------------------------------ | ||
# Copyright 2023 The Radius Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ------------------------------------------------------------ | ||
|
||
#!/bin/bash | ||
|
||
# Current time in seconds since epoch | ||
current_time=$(date +%s) | ||
|
||
# Age limit in seconds (6 hours * 3600 seconds/hour) | ||
age_limit=$((6 * 3600)) | ||
|
||
echo "Starting cluster purge script." | ||
|
||
# List clusters and their creation times, filter and delete those older than 6 hours and starting with 'eks-samplestest-' | ||
aws eks list-clusters --query "clusters[]" --output text | xargs -I {} aws eks describe-cluster --name {} --query "cluster.{name: name, createdAt: createdAt}" --output text | while read -r created_at name; do | ||
# Convert creation time to seconds since the epoch | ||
# Remove milliseconds and adjust timezone format from "-07:00" to "-0700" | ||
formatted_created_at="${created_at%.*}${created_at##*.}" | ||
formatted_created_at="${formatted_created_at%:*}${formatted_created_at##*:}" | ||
|
||
# Convert creation time to seconds | ||
created_at_seconds=$(date -d "$formatted_created_at" +%s) | ||
|
||
# Calculate age in seconds | ||
age=$((current_time - created_at_seconds)) | ||
|
||
# Check if age is greater than age limit and name starts with 'eks-samplestest-' | ||
if [ "$age" -gt "$age_limit" ] && [[ "$name" == eks-samplestest-* ]]; then | ||
echo "Deleting cluster $name older than 6 hours." | ||
eksctl delete cluster --name "$name" --wait --force | ||
else | ||
echo "Cluster $name is not older than 6 hours or does not meet naming criteria." | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,49 @@ | ||
name: Issues Automation | ||
name: Sync issue to Azure DevOps work item | ||
|
||
on: | ||
issues: | ||
types: [opened, edited, deleted, closed, reopened, labeled, unlabeled, assigned] | ||
|
||
types: | ||
[opened, edited, deleted, closed, reopened, labeled, unlabeled, assigned] | ||
|
||
concurrency: | ||
group: issue-${{ github.event.issue.number }} | ||
cancel-in-progress: false | ||
|
||
# Extra permissions needed to login with Entra ID service principal via federated identity | ||
permissions: | ||
id-token: write | ||
issues: write | ||
|
||
jobs: | ||
ado: | ||
name: Sync issue to Azure DevOps | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: issues | ||
steps: | ||
- uses: danhellem/github-actions-issue-to-work-item@v2.2 | ||
# Auth using Azure Service Principals was added as a part of v2.3 | ||
# reference: https://github.com/danhellem/github-actions-issue-to-work-item/pull/143 | ||
- name: Login to Azure | ||
uses: azure/login@v2 | ||
with: | ||
client-id: ${{ vars.AZURE_SP_DEVOPS_SYNC_CLIENT_ID }} | ||
tenant-id: ${{ vars.AZURE_SP_DEVOPS_SYNC_TENANT_ID }} | ||
allow-no-subscriptions: true | ||
- name: Get Azure DevOps token | ||
id: get_ado_token | ||
run: | ||
# The resource ID for Azure DevOps is always 499b84ac-1321-427f-aa17-267ca6975798 | ||
# https://learn.microsoft.com/azure/devops/integrate/get-started/authentication/service-principal-managed-identity | ||
echo "ADO_TOKEN=$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query "accessToken" --output tsv)" >> $GITHUB_ENV | ||
- name: Sync issue to Azure DevOps | ||
uses: danhellem/github-actions-issue-to-work-item@v2.3 | ||
env: | ||
ado_token: "${{ secrets.ADO_AOCTO_BOT_TOKEN }}" | ||
github_token: "${{ secrets.GH_RAD_CI_BOT_PAT }}" | ||
ado_organization: "azure-octo" | ||
ado_project: "Incubations" | ||
ado_token: ${{ env.ADO_TOKEN }} | ||
github_token: '${{ secrets.GH_RAD_CI_BOT_PAT }}' | ||
ado_organization: 'azure-octo' | ||
ado_project: 'Incubations' | ||
ado_area_path: "Incubations\\Radius" | ||
ado_iteration_path: "Incubations\\Radius" | ||
ado_wit: "GitHub Issue" | ||
ado_new_state: "New" | ||
ado_active_state: "Active" | ||
ado_close_state: "Closed" | ||
ado_wit: "GitHub Issue" | ||
ado_new_state: 'New' | ||
ado_active_state: 'Active' | ||
ado_close_state: 'Closed' | ||
ado_wit: 'GitHub Issue' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Purge AWS EKS Clusters | ||
|
||
on: | ||
schedule: | ||
# Runs every day at 7 AM | ||
- cron: "0 7 * * *" | ||
|
||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
AWS_REGION: us-west-2 | ||
|
||
jobs: | ||
purge_eks_clusters: | ||
name: Purge AWS EKS Clusters | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install AWS CLI | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y awscli | ||
- name: Install eksctl | ||
run: | | ||
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp | ||
sudo mv /tmp/eksctl /usr/local/bin | ||
- name: Delete old EKS clusters | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: ${{ env.AWS_REGION }} | ||
run: bash .github/scripts/purge-aws-eks-clusters.sh | ||
|
||
- name: Create GitHub issue on failure | ||
if: failure() && github.event_name != 'pull_request' | ||
run: | | ||
gh issue create --title "Purge AWS EKS Clusters workflow failed" \ | ||
--body "Test failed on ${{ github.repository }}. See [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details." \ | ||
--repo ${{ github.repository }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.