From b7087ce59d8d715e8e8a9a0e233dc4dfda03254a Mon Sep 17 00:00:00 2001 From: JarkkoTestDevSecOps <92726547+JarkkoTestDevSecOps@users.noreply.github.com> Date: Mon, 18 Oct 2021 14:56:38 +0300 Subject: [PATCH 1/8] Create codeql-analysis.yml Enabling Devops-code scanning --- .github/workflows/codeql-analysis.yml | 71 +++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 000000000..6b429259c --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,71 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '32 9 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From 05119e5598021bb71b0629256a184d6231dddc35 Mon Sep 17 00:00:00 2001 From: JarkkoTestDevSecOps <92726547+JarkkoTestDevSecOps@users.noreply.github.com> Date: Mon, 18 Oct 2021 15:01:52 +0300 Subject: [PATCH 2/8] Update codeql-analysis.yml making failure --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6b429259c..4b9f18ea0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -28,7 +28,7 @@ jobs: actions: read contents: read security-events: write - +da: yes strategy: fail-fast: false matrix: From fd43499bb4a0efd08b369b6e1a4df9c2f7ccde39 Mon Sep 17 00:00:00 2001 From: JarkkoTestDevSecOps <92726547+JarkkoTestDevSecOps@users.noreply.github.com> Date: Mon, 18 Oct 2021 15:05:17 +0300 Subject: [PATCH 3/8] Update codeql-analysis.yml remove mistakes --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4b9f18ea0..6b429259c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -28,7 +28,7 @@ jobs: actions: read contents: read security-events: write -da: yes + strategy: fail-fast: false matrix: From 5737303011768055022cddec6609de657871ff0a Mon Sep 17 00:00:00 2001 From: JarkkoTestDevSecOps <92726547+JarkkoTestDevSecOps@users.noreply.github.com> Date: Mon, 18 Oct 2021 15:13:54 +0300 Subject: [PATCH 4/8] Update codeql-analysis.yml Changed Name --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6b429259c..ce54e9dea 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,7 +9,7 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: "CakeFactory" on: push: From 50085c03bbe460f1d470025f083a67e9df12170f Mon Sep 17 00:00:00 2001 From: JarkkoTestDevSecOps <92726547+JarkkoTestDevSecOps@users.noreply.github.com> Date: Mon, 18 Oct 2021 15:16:24 +0300 Subject: [PATCH 5/8] Update codeql-analysis.yml Updated name again --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ce54e9dea..7ae5e3542 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,7 +9,7 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CakeFactory" +name: "CakeOneFactory" on: push: From 4de1dc4c6e44a40c80adfe8275f47d43024d1526 Mon Sep 17 00:00:00 2001 From: JarkkoTestDevSecOps <92726547+JarkkoTestDevSecOps@users.noreply.github.com> Date: Tue, 19 Oct 2021 10:38:09 +0300 Subject: [PATCH 6/8] Rename codeql-analysis.yml to codeql-analysis.yml Testing commiting --- .github/workflows/{codeql-analysis.yml => codeql-analysis.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{codeql-analysis.yml => codeql-analysis.yml} (100%) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/ codeql-analysis.yml similarity index 100% rename from .github/workflows/codeql-analysis.yml rename to .github/workflows/ codeql-analysis.yml From c41f222de30c99051d02889bbe20fcb042af28c3 Mon Sep 17 00:00:00 2001 From: JarkkoTestDevSecOps <92726547+JarkkoTestDevSecOps@users.noreply.github.com> Date: Tue, 19 Oct 2021 10:41:00 +0300 Subject: [PATCH 7/8] Update codeql-analysis.yml changing analyze to analze --- .github/workflows/{ codeql-analysis.yml => codeql-analysis.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{ codeql-analysis.yml => codeql-analysis.yml} (99%) diff --git a/.github/workflows/ codeql-analysis.yml b/.github/workflows/codeql-analysis.yml similarity index 99% rename from .github/workflows/ codeql-analysis.yml rename to .github/workflows/codeql-analysis.yml index 7ae5e3542..28bf0b9c1 100644 --- a/.github/workflows/ codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -21,7 +21,7 @@ on: - cron: '32 9 * * 4' jobs: - analyze: + analze: name: Analyze runs-on: ubuntu-latest permissions: From 969c7c262d4e2877d5e363f564495848f4c9ac77 Mon Sep 17 00:00:00 2001 From: JarkkoTestDevSecOps <92726547+JarkkoTestDevSecOps@users.noreply.github.com> Date: Tue, 19 Oct 2021 13:37:22 +0300 Subject: [PATCH 8/8] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..059ddd126 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,39 @@ +# Docker +# Build and push an image to Azure Container Registry +# https://docs.microsoft.com/azure/devops/pipelines/languages/docker + +trigger: +- master + +resources: +- repo: self + +variables: + # Container registry service connection established during pipeline creation + dockerRegistryServiceConnection: 'bbc00546-6924-4a6f-981e-eb246a6761fb' + imageRepository: 'mydocimage1' + containerRegistry: 'devsecopscontainer212.azurecr.io' + dockerfilePath: '$(Build.SourcesDirectory)/app/Dockerfile' + tag: '$(Build.BuildId)' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + +stages: +- stage: Build + displayName: Build and push stage + jobs: + - job: Build + displayName: Build + pool: + vmImage: $(vmImageName) + steps: + - task: Docker@2 + displayName: Build and push an image to container registry + inputs: + command: buildAndPush + repository: $(imageRepository) + dockerfile: $(dockerfilePath) + containerRegistry: $(dockerRegistryServiceConnection) + tags: | + $(tag)