From 7e4f89f80a71b6cb70ab239ecb7f7082a5217389 Mon Sep 17 00:00:00 2001 From: Lino Tadros Date: Sun, 25 Feb 2024 14:29:12 -0500 Subject: [PATCH 1/6] initial commit --- .github/workflows/first-workflow.yml | 54 ++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/first-workflow.yml diff --git a/.github/workflows/first-workflow.yml b/.github/workflows/first-workflow.yml new file mode 100644 index 00000000..4c01d052 --- /dev/null +++ b/.github/workflows/first-workflow.yml @@ -0,0 +1,54 @@ +# The name of the job is what will display on the GitHub repository in the Actions tab. +name: First Workflow + +# The 'on' section tells GitHub under what conditions we want to run this workflow. +# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows +# Common scenarios include: + # workflow-dispatch (manual execution) + # issues + # push + # pull_request + # schedule +on: + workflow_dispatch: + +# This section covers the work to perform. +# We include one or more jobs in this section. +jobs: + # Each individual job will include details like execution order, + # pre-requisite jobs, and execution platform. + job1: + # We can run jobs on GitHub hosted VM runners in Windows, Ubuntu, and Mac OS. + # We can also run jobs on self-hosted hardware. + runs-on: ubuntu-latest + + # Each job contains one or more steps. A step needs to have at least a name and a command. + steps: + - name: Step one + # The 'run' command executes a shell or command script. Because this is Ubuntu, the + # default run command will be /bin/bash + run: echo "Log from step one" + # This section does not appear in the solution file but demonstrates how to set + # custom variables that will be available in the run script. + env: + VARIABLE_NAME: value + - name: Step two + run: echo "Log from step two" + + job2: + # Job 2 will only run after job 1 completes. + # Removing this 'needs' section would make the jobs run simultaneously. + needs: job1 + runs-on: ubuntu-latest + + steps: + - name: Cowsays + # The 'uses' command executes a remote GitHub action. + # A command like mscoutermarsh/cowsays-action means you can + # find this code at https://github.com/mscoutermarsh/cowsays-action + uses: mscoutermarsh/cowsays-action@master + # The 'with' block includes parameters that the workflow will pass + # to this action. Parameters are all in key-value format. + with: + text: 'Ready for prod--ship it!' + color: 'magenta' \ No newline at end of file From 8d7a1eca2fed74d360d963c7c1aff2585da9ba2d Mon Sep 17 00:00:00 2001 From: Lino Tadros Date: Sun, 25 Feb 2024 14:41:30 -0500 Subject: [PATCH 2/6] resolves #2 --- Application/src/RazorPagesTestSample/Data/Message.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Application/src/RazorPagesTestSample/Data/Message.cs b/Application/src/RazorPagesTestSample/Data/Message.cs index ea99cbd6..69bdcd34 100644 --- a/Application/src/RazorPagesTestSample/Data/Message.cs +++ b/Application/src/RazorPagesTestSample/Data/Message.cs @@ -9,8 +9,10 @@ public class Message [Required] [DataType(DataType.Text)] - [StringLength(200, ErrorMessage = "There's a 200 character limit on messages. Please shorten your message.")] + [StringLength(250, ErrorMessage = "There's a 250 character limit on messages. Please shorten your message.")] public string Text { get; set; } } #endregion + + // Write a loop from 0 to 10 and print out the numeric value of the iterator for each loop iteration } From 45292b0fa47a686bf571641e6aba3e855ce8be08 Mon Sep 17 00:00:00 2001 From: Lino Tadros Date: Sun, 25 Feb 2024 14:44:00 -0500 Subject: [PATCH 3/6] revert --- Application/src/RazorPagesTestSample/Data/Message.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/src/RazorPagesTestSample/Data/Message.cs b/Application/src/RazorPagesTestSample/Data/Message.cs index 69bdcd34..30965b53 100644 --- a/Application/src/RazorPagesTestSample/Data/Message.cs +++ b/Application/src/RazorPagesTestSample/Data/Message.cs @@ -9,7 +9,7 @@ public class Message [Required] [DataType(DataType.Text)] - [StringLength(250, ErrorMessage = "There's a 250 character limit on messages. Please shorten your message.")] + [StringLength(200, ErrorMessage = "There's a 200 character limit on messages. Please shorten your message.")] public string Text { get; set; } } #endregion From 85c345fb450a3bba4e2c0cdcc066d66ef7b61461 Mon Sep 17 00:00:00 2001 From: Lino Tadros Date: Sun, 25 Feb 2024 14:46:21 -0500 Subject: [PATCH 4/6] adding changes to 250 to branch --- Application/src/RazorPagesTestSample/Data/Message.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/src/RazorPagesTestSample/Data/Message.cs b/Application/src/RazorPagesTestSample/Data/Message.cs index 30965b53..69bdcd34 100644 --- a/Application/src/RazorPagesTestSample/Data/Message.cs +++ b/Application/src/RazorPagesTestSample/Data/Message.cs @@ -9,7 +9,7 @@ public class Message [Required] [DataType(DataType.Text)] - [StringLength(200, ErrorMessage = "There's a 200 character limit on messages. Please shorten your message.")] + [StringLength(250, ErrorMessage = "There's a 250 character limit on messages. Please shorten your message.")] public string Text { get; set; } } #endregion From 69671178452e12f4bdea5ebe1fb34bfdda86c1d5 Mon Sep 17 00:00:00 2001 From: Lino Tadros Date: Tue, 27 Feb 2024 21:20:40 -0500 Subject: [PATCH 5/6] devops additions 0303 --- .github/workflows/deploy.yml | 52 +++++++++++++++++++ .../src/RazorPagesTestSample/Data/Message.cs | 3 +- credentials.json | 9 ++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 credentials.json diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..d9b86101 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,52 @@ +# We only want to run this script manually. +on: + workflow_dispatch + + # Environment variables are defined in an "env" section. + # We set the target environment to dev. + # Open the deploy-advanced.yml file to see how we can accept user input + # instead of needing to change this file to switch environments. + env: + targetEnv: dev + + # The overall workflow name will be Azure Bicep. This will show up in the + # GitHub Action page. + name: Azure Bicep + jobs: + # This script has one job: build and deploy the IaC resources + build-and-deploy: + # We run this on an Ubuntu-based GitHub hosted runner. This hosted runner + # has certain software already installed, including az cli + runs-on: ubuntu-latest + steps: + # Check out the code. This grabs code from the repository and + # makes it available to the GitHub hosted runner. It will usually be the + # first task for any workflow + - uses: actions/checkout@main + + # Log into Azure using a federated credential. We have already set up the + # federation process in a prior step, so we need to pass in the following: + # Client ID = Application registration ID + # Tenant ID = Application owner organization ID (previously called Tenant ID in Azure) + # Subscription ID + # https://github.com/azure/login + - uses: azure/login@v1 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + # We also need to ensure that enable-AzPSSession is true. This is important for + # using OIDC in Azure. If we were to pass in a client secret instead, we would not need + # this setting enabled + enable-AzPSSession: true + + # Deploy ARM template + - name: Run ARM deploy + # https://github.com/azure/arm-deploy + uses: azure/arm-deploy@v1 + with: + subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + resourceGroupName: ${{ secrets.AZURE_RG }} + template: ./InfrastructureAsCode/main.bicep + # Use the environment variable called targetEnv + parameters: environment=${{ env.targetEnv }} \ No newline at end of file diff --git a/Application/src/RazorPagesTestSample/Data/Message.cs b/Application/src/RazorPagesTestSample/Data/Message.cs index 69bdcd34..ff2d1027 100644 --- a/Application/src/RazorPagesTestSample/Data/Message.cs +++ b/Application/src/RazorPagesTestSample/Data/Message.cs @@ -9,10 +9,11 @@ public class Message [Required] [DataType(DataType.Text)] - [StringLength(250, ErrorMessage = "There's a 250 character limit on messages. Please shorten your message.")] + [StringLength(200, ErrorMessage = "There's a 200 character limit on messages. Please shorten your message.")] public string Text { get; set; } } #endregion // Write a loop from 0 to 10 and print out the numeric value of the iterator for each loop iteration + } diff --git a/credentials.json b/credentials.json new file mode 100644 index 00000000..e3e19fa9 --- /dev/null +++ b/credentials.json @@ -0,0 +1,9 @@ +{ + "name": "GitHubDevOpsCredential", + "issuer": "https://token.actions.githubusercontent.com", + "subject": "repo:thetrainingboss/TechExcel-Implementing-DevOps-practices-to-accelerate-developer-productivity-code:ref:refs/heads/main", + "description": "Deploy Azure resources from the TechExcel DevOps practices GitHub repo", + "audiences": [ + "api://AzureADTokenExchange" + ] +} \ No newline at end of file From ed5ca2441875816e2915071bf00ae33234bdfb47 Mon Sep 17 00:00:00 2001 From: Lino Tadros Date: Tue, 27 Feb 2024 21:22:57 -0500 Subject: [PATCH 6/6] fix --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d9b86101..483be4e3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,3 +1,4 @@ +name: Deploy Workflow # We only want to run this script manually. on: workflow_dispatch