Skip to content

Commit ce9f67c

Browse files
Jeel-mehtaJeel Mehtaharrryr
authored
Final code for dotnet sample app deployment (#340)
*Issue description:* *Description of changes:* I have dynamically deployed the sample app for both the versions of dotnet support (8.0 and 6.0). I am attaching a link of github workflow where I have tested my code for version 6.0 and 8.0 for the region us-east-1. This specific code change will include and handle both versions for all the regions. *Rollback procedure:* <Can we safely revert this commit if needed? If not, detail what must be done to safely revert and why it is needed.> *Ensure you've run the following tests on your changes and include the link below:* To do so, create a `test.yml` file with `name: Test` and workflow description to test your changes, then remove the file for your PR. Link your test run in your PR description. This process is a short term solution while we work on creating a staging environment for testing. NOTE: TESTS RUNNING ON A SINGLE EKS CLUSTER CANNOT BE RUN IN PARALLEL. See the [needs](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds) keyword to run tests in succession. - Run Java EKS on `e2e-playground` in us-east-1 and eu-central-2 - Run Python EKS on `e2e-playground` in us-east-1 and eu-central-2 - Run metric limiter on EKS cluster `e2e-playground` in us-east-1 and eu-central-2 - Run EC2 tests in all regions - Run K8s on a separate K8s cluster (check IAD test account for master node endpoints; these will change as we create and destroy clusters for OS patching) By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. Co-authored-by: Jeel Mehta <[email protected]> Co-authored-by: Harry <[email protected]>
1 parent 3646850 commit ce9f67c

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

.github/workflows/dotnet-sample-app-s3-deploy.yml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ jobs:
1818
'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1',
1919
'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1',
2020
'us-east-1','us-east-2', 'us-west-1', 'us-west-2' ]
21+
dotnet-version: [ '6.0', '8.0' ]
2122
runs-on: ubuntu-latest
23+
env:
24+
DEFAULT_VERSION: '8.0'
25+
DOTNET_VERSION: ${{ matrix.dotnet-version }}
2226
steps:
2327
- uses: actions/checkout@v4
2428
with:
@@ -42,13 +46,55 @@ jobs:
4246
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ secrets.E2E_TEST_ROLE_ARN }}
4347
aws-region: ${{ matrix.aws-region }}
4448

49+
- name: Update .NET version if not default
50+
working-directory: sample-apps/dotnet
51+
run: |
52+
if [ "${DOTNET_VERSION}" != "${DEFAULT_VERSION}" ]; then
53+
echo "Updating .NET version from ${DEFAULT_VERSION} to ${DOTNET_VERSION}"
54+
55+
# Function to update version in files
56+
update_version() {
57+
local file=$1
58+
if [ ! -f "$file" ]; then
59+
echo "Error: File $file not found"
60+
exit 1
61+
fi
62+
63+
# Update TargetFramework in csproj files
64+
if [[ $file == *.csproj ]]; then
65+
sed -i "s/<TargetFramework>netcoreapp${DEFAULT_VERSION}<\/TargetFramework>/<TargetFramework>netcoreapp${DOTNET_VERSION}<\/TargetFramework>/g" "$file"
66+
fi
67+
68+
if [ $? -ne 0 ]; then
69+
echo "Error: Failed to update version in $file"
70+
exit 1
71+
fi
72+
echo "Successfully updated $file"
73+
}
74+
75+
# Update all relevant files
76+
update_version "asp_frontend_service/asp_frontend_service.csproj"
77+
update_version "asp_remote_service/asp_remote_service.csproj"
78+
79+
80+
# Verify changes
81+
echo "Verifying changes..."
82+
echo "=== Frontend csproj ==="
83+
grep -n "TargetFramework" asp_frontend_service/asp_frontend_service.csproj
84+
echo "=== Remote csproj ==="
85+
grep -n "TargetFramework" asp_remote_service/asp_remote_service.csproj
86+
87+
else
88+
echo "Using default version ${DEFAULT_VERSION}, no changes needed"
89+
fi
90+
4591
- name: Build Sample App Zip
4692
working-directory: sample-apps/dotnet
47-
run: zip -r dotnet-sample-app.zip .
93+
run: zip -r dotnet-sample-app-${DOTNET_VERSION}.zip .
4894

4995
- name: Upload to S3
5096
working-directory: sample-apps/dotnet
51-
run: aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body ./dotnet-sample-app.zip --key dotnet-sample-app.zip
97+
run: aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body ./dotnet-sample-app-${DOTNET_VERSION}.zip --key dotnet-sample-app-${DOTNET_VERSION}.zip
5298

5399
- name: Upload Windows Script to S3
54100
working-directory: sample-apps/dotnet

0 commit comments

Comments
 (0)