Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up CI with Azure Pipelines #3577

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
126 changes: 126 additions & 0 deletions azure-devops/azure-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
trigger:
branches:
include:
- master
- vnext

# This pipeline is meant to build specific branches for deployment. It's not meant to be a part of PR validation. Ensure that this pipeline is reserved for deployment purposes.
pr: none

name: $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)

variables:
githubToken: <value> # Add a GitHub token in Libraries
ReplacementText: '@infragistics/igniteui-angular-extras'

jobs:
- job: CommonSteps
displayName: Common Steps for All Jobs
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
clean: true
fetchTags: true

- task: NodeTool@0
displayName: Use Node 20.x
inputs:
versionSpec: 20.x

- task: PowerShell@2
displayName: 'Replace with licensed angular-extras'
inputs:
targetType: 'inline'
script: |
# List of files to update
$files = @(
"projects/app-lob/src/app/grid-dynamic-chart-data/grid-dynamic-chart-data.module.ts",
"projects/app-lob/src/app/grid-dynamic-chart-data/grid-dynamic-chart-data.component.ts",
"projects/app-lob/src/app/app.module.ts",
"package.json")
foreach ($file in $files) {
(Get-Content -Path $file) -replace 'igniteui-angular-extras', '$(ReplacementText)' | Set-Content -Path $file
}

- task: Npm@1
displayName: 'Register licensed npm registry in .npmrc'
inputs:
command: 'custom'
workingDir: '$(Build.SourcesDirectory)'
customCommand: 'config -L project set @infragistics:registry=https://packages.infragistics.com/npm/js-licensed/'
customEndpoint: 'public proget'

- task: Npm@1
displayName: npm install
inputs:
command: install
workingDir: $(Build.SourcesDirectory)
verbose: false
customEndpoint: 'public proget'

- task: CmdLine@2
displayName: Clone submodule
inputs:
script: git clone --recurse-submodules https://github.com/IgniteUI/igniteui-live-editing-samples igniteui-live-editing-samples
workingDirectory: $(Build.SourcesDirectory)

- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.SourcesDirectory)'
artifact: 'source-code'
publishLocation: 'pipeline'

- job: Job_1
displayName: App CD Build
dependsOn: CommonSteps
pool:
vmImage: ubuntu-latest
steps:
- download: current
artifact: source-code
- template: templates/cd-template.yml
parameters:
customCommand: run generate-live-editing
workingDir: $(Build.SourcesDirectory)
submoduleDir: angular-demos
baseHref: /angular-demos/
targetFolder: dist/app-lob
findRegex: angular-demos
npmBuildCommand: 'run build-ci'

- job: Job_2
displayName: App CRM Build
dependsOn: CommonSteps
pool:
vmImage: ubuntu-latest
steps:
- download: current
artifact: source-code
- template: templates/cd-template.yml
parameters:
customCommand: run generate-live-editing:app-crm
workingDir: $(Build.SourcesDirectory)
submoduleDir: angular-demos-crm
baseHref: /angular-demos-grid-crm/
targetFolder: dist/app-crm
findRegex: angular-demos
npmBuildCommand: 'run build-ci:app-crm --loglevel verbose'

- job: Job_3
displayName: App LOB Build
dependsOn: CommonSteps
pool:
vmImage: ubuntu-latest
steps:
- download: current
artifact: source-code
- template: templates/cd-template.yml
parameters:
customCommand: run generate-live-editing:app-lob
workingDir: $(Build.SourcesDirectory)
submoduleDir: angular-demos-lob
baseHref: /angular-demos-lob/
targetFolder: dist/app-lob
findRegex: angular-demos
npmBuildCommand: 'run build-ci:app-lob'
144 changes: 144 additions & 0 deletions azure-devops/templates/cd-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# template.yml
parameters:
- name: customCommand
type: string
- name: workingDir
type: string
- name: submoduleDir
type: string
- name: baseHref
type: string
- name: targetFolder
type: string
default: 'dist'
- name: findRegex
type: string
- name: npmBuildCommand
type: string
default: ''
- name: runCleanup
type: boolean
default: true

steps:
# - task: CmdLine@2
# displayName: Clone submodule
# inputs:
# script: git clone --recurse-submodules https://github.com/IgniteUI/igniteui-live-editing-samples igniteui-live-editing-samples
# workingDirectory: ${{ parameters.workingDir }}

- task: CmdLine@2
displayName: Staging - Git checkout branch
condition: eq(variables['Build.SourceBranchName'], 'vNext')
inputs:
script: git checkout vNext
workingDirectory: ${{ parameters.workingDir }}/igniteui-live-editing-samples

- task: CmdLine@2
displayName: Production - Git checkout branch
condition: and(eq(variables['Build.SourceBranchName'], 'master'), contains(variables['build.reason'], 'CI'))
inputs:
script: git checkout master
workingDirectory: ${{ parameters.workingDir }}/igniteui-live-editing-samples

- script: |
sed -i 's/--configuration production/--base-href=${{ parameters.baseHref }} --configuration production/g' package.json
displayName: 'Update package.json file'
workingDirectory: ${{ parameters.workingDir }}

- task: Npm@1
displayName: generate live-editing
inputs:
command: custom
workingDir: ${{ parameters.workingDir }}
verbose: false
customCommand: ${{ parameters.customCommand }}

- task: CmdLine@2
displayName: Update to licensed igniteui-angular
inputs:
script: npx ng g @igniteui/angular-schematics:upgrade-packages --skip-install
workingDirectory: ${{ parameters.workingDir }}

- task: Npm@1
displayName: ${{ parameters.npmBuildCommand }}
inputs:
command: custom
workingDir: ${{ parameters.workingDir }}
verbose: false
customCommand: ${{ parameters.npmBuildCommand }}

- task: CopyFiles@2
displayName: Copy web.config
inputs:
SourceFolder: $(Build.SourcesDirectory)
Contents: web.config
TargetFolder: $(Build.SourcesDirectory)/${{ parameters.targetFolder }}

- task: RegexReplace@3
displayName: RegEx Find & Replace
inputs:
InputSearchPattern: $(Build.SourcesDirectory)/${{ parameters.targetFolder }}/web.config
FindRegex: ${{ parameters.findRegex }}
ReplaceRegex: ${{ parameters.submoduleDir }}
UseUTF8: false

- task: PublishPipelineArtifact@1
displayName: Publish Artifact
inputs:
targetPath: $(Build.SourcesDirectory)/${{ parameters.targetFolder }}
artifact: $(Build.SourceBranchName)-artifact
publishLocation: pipeline

- task: Npm@1
displayName: Staging - Repositorify Angular Demos and LOB Demos
condition: eq(variables['Build.SourceBranchName'], 'vNext')
inputs:
command: custom
workingDir: ${{ parameters.workingDir }}
verbose: false
customCommand: run repositoryfyAngularDemosLob

- task: Npm@1
displayName: Production - Repositorify Angular Demos
condition: and(eq(variables['Build.SourceBranchName'], 'master'), contains(variables['build.reason'], 'CI'))
inputs:
command: custom
workingDir: ${{ parameters.workingDir }}
verbose: false
customCommand: run repositoryfyAngularDemosLob:prod

- task: CmdLine@2
displayName: Stage changes
inputs:
script: git add .
workingDirectory: ${{ parameters.workingDir }}/igniteui-live-editing-samples/${{ parameters.submoduleDir }}

- task: CmdLine@2
displayName: 'Check if there are any changes to be committed'
inputs:
script: |
# Check for changes
changeCount=$(git status --porcelain | wc -l)
if [ "$changeCount" -eq 0 ]; then
echo "##vso[task.logissue type=warning]No changes to commit."
exit 0
fi
workingDirectory: ${{ parameters.workingDir }}/igniteui-live-editing-samples/${{ parameters.submoduleDir }}


- task: CmdLine@2
displayName: Commit changes
inputs:
script: git commit -m "Automated repository update"
workingDirectory: ${{ parameters.workingDir }}/igniteui-live-editing-samples/${{ parameters.submoduleDir }}

- task: CmdLine@2
displayName: Push changes
inputs:
script: git push
workingDirectory: ${{ parameters.workingDir }}/igniteui-live-editing-samples/${{ parameters.submoduleDir }}

- task: PostBuildCleanup@4
displayName: Clean Agent Directories
condition: eq('${{ parameters.runCleanup }}', 'true')
2 changes: 2 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@
return;
}

console.log(process.env);

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This logs sensitive data returned by
process environment
as clear text.

Copilot Autofix AI 8 days ago

To fix the problem, we should avoid logging the entire process.env object. Instead, we can log only non-sensitive information or avoid logging environment variables altogether. In this case, we will remove the logging of process.env to ensure no sensitive information is exposed.

  • Remove the line that logs process.env.
  • No additional methods, imports, or definitions are needed.
Suggested changeset 1
gulpfile.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/gulpfile.js b/gulpfile.js
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -249,3 +249,3 @@
 
-    console.log(process.env);
+    // Removed logging of process.env to avoid exposing sensitive information
 
EOF
@@ -249,3 +249,3 @@

console.log(process.env);
// Removed logging of process.env to avoid exposing sensitive information

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options

const gitHooksDir = './.git/hooks/';
const defaultCopyHookDir = gitHooksDir + 'scripts/';
const dirs = [
Expand Down
Loading