-
Notifications
You must be signed in to change notification settings - Fork 1
feat: update pipeline #30
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,128 @@ | ||
| # ===================================================== | ||
| # Template: Build Frontend | ||
| # ===================================================== | ||
| # Builds the React frontend application using Vite | ||
| # Supports validation builds (PR) and artifact publishing (CD) | ||
| # ===================================================== | ||
|
|
||
| parameters: | ||
| - name: environment | ||
| type: string | ||
| values: | ||
| - dev | ||
| - qa | ||
| - uat | ||
| - prod | ||
|
|
||
| - name: isValidationBuild | ||
| type: boolean | ||
| default: false | ||
|
|
||
| - name: nodeVersion | ||
| type: string | ||
| default: "22.x" | ||
|
|
||
| jobs: | ||
| - job: Build_Frontend_${{ parameters.environment }} | ||
| displayName: "Build Frontend [${{ parameters.environment }}]" | ||
| displayName: "🏗️ Build Frontend [${{ parameters.environment }}]" | ||
| pool: | ||
| vmImage: "ubuntu-latest" | ||
| vmImage: ubuntu-latest | ||
|
|
||
| variables: | ||
| - name: VITE_VERSION_NUMBER | ||
| value: $(Build.BuildNumber) | ||
| - name: VITE_ENV | ||
| value: "${{ parameters.environment }}" | ||
| value: ${{ parameters.environment }} | ||
| - name: VITE_API_URL | ||
| value: "$(api-url-${{ parameters.environment }})" | ||
| value: $(api-url-${{ parameters.environment }}) | ||
| - name: VITE_GA_TRACKING_ID | ||
| value: "$(ga-tracking-id-${{ parameters.environment }})" | ||
| value: $(ga-tracking-id-${{ parameters.environment }}) | ||
| - name: VITE_GENERATE_SOURCEMAP | ||
| value: false | ||
| value: ${{ eq(parameters.environment, 'dev') }} | ||
| - name: CI | ||
| value: true | ||
|
|
||
| steps: | ||
| # --------------------------------------------------- | ||
| # Setup Node.js Environment | ||
| # --------------------------------------------------- | ||
| - task: NodeTool@0 | ||
| displayName: "Node.js Version" | ||
| displayName: "📦 Setup Node.js ${{ parameters.nodeVersion }}" | ||
| inputs: | ||
| versionSpec: "22.x" | ||
| versionSpec: ${{ parameters.nodeVersion }} | ||
|
|
||
| # --------------------------------------------------- | ||
| # Prepare Cache Directory | ||
| # --------------------------------------------------- | ||
| - script: mkdir -p $(System.DefaultWorkingDirectory)/frontend/.yarn/cache | ||
| displayName: "📁 Create cache directory" | ||
| workingDirectory: $(System.DefaultWorkingDirectory) | ||
|
|
||
| # --------------------------------------------------- | ||
| # Cache Dependencies | ||
| # --------------------------------------------------- | ||
| - task: Cache@2 | ||
| displayName: "📥 Cache Yarn dependencies" | ||
| inputs: | ||
| key: 'yarn | "$(Agent.OS)" | frontend/yarn.lock' | ||
| restoreKeys: | | ||
| yarn | "$(Agent.OS)" | ||
| yarn | ||
| path: $(System.DefaultWorkingDirectory)/frontend/.yarn/cache | ||
| continueOnError: true | ||
|
|
||
| # --------------------------------------------------- | ||
| # Install Dependencies | ||
| # --------------------------------------------------- | ||
| - script: | | ||
| cd frontend | ||
| corepack enable | ||
| yarn set version stable | ||
| yarn | ||
| yarn build | ||
| displayName: "Install and Build using Yarn" | ||
| yarn install --immutable | ||
| displayName: "📥 Install dependencies" | ||
| workingDirectory: $(System.DefaultWorkingDirectory)/frontend | ||
| env: | ||
| YARN_CACHE_FOLDER: $(System.DefaultWorkingDirectory)/frontend/.yarn/cache | ||
|
|
||
| - task: CopyFiles@2 | ||
| displayName: "Copy files to build folder" | ||
| inputs: | ||
| sourceFolder: "$(System.DefaultWorkingDirectory)/frontend/dist" | ||
| targetFolder: "$(Build.ArtifactStagingDirectory)" | ||
| cleanTargetFolder: true | ||
| # --------------------------------------------------- | ||
| # Code Quality Checks (PR only) | ||
| # --------------------------------------------------- | ||
| - ${{ if eq(parameters.isValidationBuild, true) }}: | ||
| - script: yarn lint | ||
| displayName: "🔍 Run linting" | ||
| workingDirectory: $(System.DefaultWorkingDirectory)/frontend | ||
|
|
||
| - task: PublishBuildArtifacts@1 | ||
| displayName: "Publish artifact" | ||
| inputs: | ||
| pathtoPublish: "$(Build.ArtifactStagingDirectory)" | ||
| artifactName: "build_frontend_${{ parameters.environment }}" | ||
| - script: yarn tsc --noEmit | ||
| displayName: "🔍 TypeScript type check" | ||
| workingDirectory: $(System.DefaultWorkingDirectory)/frontend | ||
| continueOnError: false | ||
|
|
||
| # --------------------------------------------------- | ||
| # Build Application | ||
| # --------------------------------------------------- | ||
| - script: yarn build | ||
| displayName: "🏗️ Build application" | ||
| workingDirectory: $(System.DefaultWorkingDirectory)/frontend | ||
| env: | ||
| VITE_VERSION_NUMBER: $(VITE_VERSION_NUMBER) | ||
| VITE_ENV: $(VITE_ENV) | ||
| VITE_API_URL: $(VITE_API_URL) | ||
| VITE_GA_TRACKING_ID: $(VITE_GA_TRACKING_ID) | ||
| VITE_GENERATE_SOURCEMAP: $(VITE_GENERATE_SOURCEMAP) | ||
|
|
||
| # --------------------------------------------------- | ||
| # Publish Artifacts (CD only) | ||
| # --------------------------------------------------- | ||
| - ${{ if eq(parameters.isValidationBuild, false) }}: | ||
| - task: CopyFiles@2 | ||
| displayName: "📋 Copy build files" | ||
| inputs: | ||
| sourceFolder: $(System.DefaultWorkingDirectory)/frontend/dist | ||
| targetFolder: $(Build.ArtifactStagingDirectory)/frontend | ||
| cleanTargetFolder: true | ||
|
|
||
| - task: PublishPipelineArtifact@1 | ||
| displayName: "📤 Publish build artifact" | ||
| inputs: | ||
| targetPath: $(Build.ArtifactStagingDirectory)/frontend | ||
| artifact: frontend-${{ parameters.environment }} | ||
| publishLocation: pipeline | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,53 +1,157 @@ | ||||||
| # ===================================================== | ||||||
| # Template: Deploy Frontend | ||||||
| # ===================================================== | ||||||
| # Deploys React frontend to Azure Blob Storage | ||||||
| # with CDN cache purge | ||||||
| # ===================================================== | ||||||
|
|
||||||
| parameters: | ||||||
| - name: environment | ||||||
| type: string | ||||||
| values: | ||||||
| - dev | ||||||
| - qa | ||||||
| - uat | ||||||
| - prod | ||||||
|
|
||||||
| - name: commandOptions | ||||||
| type: string | ||||||
| - name: depends_on | ||||||
|
|
||||||
| - name: dependsOn | ||||||
| type: object | ||||||
| default: "" | ||||||
| default: [] | ||||||
|
|
||||||
| - name: terraformVersion | ||||||
| type: string | ||||||
| default: "1.10.3" | ||||||
|
||||||
| default: "1.10.3" | |
| default: "1.14.4" |
Copilot
AI
Feb 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The storage account naming logic in the pipeline (st + PROJECT_SHORT_NAME + environment) doesn't match the Terraform logic which uses substr(replace("st${var.project_short_name}${var.environment}", "-", ""), 0, 24). If PROJECT_SHORT_NAME or the environment contains hyphens, the pipeline variable won't match the actual storage account name created by Terraform, causing deployment failures. The pipeline should use the same logic or reference the Terraform output.
| value: st$(PROJECT_SHORT_NAME)${{ parameters.environment }} | |
| value: ${{ substring(replace(format('st{0}{1}', variables['PROJECT_SHORT_NAME'], parameters.environment), '-', ''), 0, 24) }} |
Copilot
AI
Feb 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache purge task has failOnStandardError set to false, which means errors during cache purge will be silently ignored. While this prevents deployment failures due to cache purge issues, it could lead to users seeing stale content. Consider setting this to true and handling cache purge failures explicitly, or at least add logging to alert when cache purge fails.
| failOnStandardError: false | |
| failOnStandardError: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default Node.js version is set to "22.x", but the main pipeline specifies "24.x" in the global variables. Update this default to match "24.x" to ensure consistency across all builds.