Skip to content

Commit

Permalink
Use 1es templates (#537)
Browse files Browse the repository at this point in the history
Add 1es redirect template and update pipeline templates to use it as a
base
  • Loading branch information
hallipr authored Mar 28, 2024
1 parent 52ae41b commit 909ed30
Show file tree
Hide file tree
Showing 11 changed files with 441 additions and 300 deletions.
7 changes: 7 additions & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,29 @@ words:
- DMSS
- Donezo
- dynatrace
- espt
- foos
- horiz
- Howtos
- infile
- kvset
- liftr
- LINUXNEXTVMIMAGE
- LINUXOS
- LINUXVMIMAGE
- logz
- LRO
- lropaging
- Lucene
- MACVMIMAGE
- msazure
- msdata
- mylocation
- nupkg
- odata
- Onco
- oncophenotype
- psscriptanalyzer
- PAYG
- prismjs
- qnas
Expand All @@ -59,3 +65,4 @@ words:
- SERVICERP
- tcgc
- userrp
- WINDOWSVMIMAGE
13 changes: 13 additions & 0 deletions eng/CredScanSuppression.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"tool": "Credential Scanner",
"suppressions": [
{
"placeholder": ["abcdef12345", "Y0uW1llN3v3rGu3ss!"],
"_justification": "Secrets used by test code or documentation, they are fake."
},
{
"file": ["packages/website/docusaurus.config.ts"],
"_justification": "Files contains publicly disclosed application key."
}
]
}
208 changes: 105 additions & 103 deletions eng/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,107 +12,109 @@ trigger:

pr: none

variables:
- template: templates/variables/globals.yml

jobs:
- job: npm_stable
timeoutInMinutes: 90
displayName: Npm publish
pool:
name: azsdk-pool-mms-win-2022-general
vmImage: windows-2022

extends:
template: /eng/pipelines/templates/1es-redirect.yml
parameters:
variables:
TYPESPEC_SKIP_DOCUSAURUS_BUILD: true # Disable docusaurus build

steps:
- checkout: self
submodules: true

- template: ./templates/install.yml
parameters:
nodeVersion: "20.x"

- template: ./templates/build.yml

- script: pnpm run test-official
displayName: Test

- template: ./templates/upload-coverage.yml

- script: pnpm run pack:all
displayName: Pack packages

- pwsh: |
echo "Updating config"
pnpm config set '//registry.npmjs.org/:_authToken' '${NPM_AUTH_TOKEN}'
echo "Publishing"
pnpm chronus publish "./temp/artifacts/*.tgz" --access public --engine npm --report-summary ./publish-summary.json
name: Publish
env:
NPM_AUTH_TOKEN: $(azure-sdk-npm-token)
- script: |
echo "Publish summary:"
cat ./publish-summary.json
displayName: Log publish summary
- script: pnpm chronus-github create-releases --repo azure/typespec-azure --publish-summary ./publish-summary.json
displayName: Create github releases
env:
GITHUB_TOKEN: $(azuresdk-github-pat)

- task: AzureCLI@1
displayName: "Publish bundled packages to package storage"
inputs:
azureSubscription: "Azure SDK Engineering System"
scriptLocation: inlineScript
inlineScript: node ./eng/scripts/upload-bundler-packages.js

- task: AzureCLI@1
displayName: "Publish Azure playground"
inputs:
azureSubscription: "Azure SDK Engineering System"
scriptLocation: inlineScript
inlineScript: |
az storage blob upload-batch ^
--destination $web ^
--account-name "cadlplayground" ^
--destination-path cadl-azure/ ^
--source "./packages/typespec-azure-playground-website/dist/" ^
--overwrite
- job: npm_preview
timeoutInMinutes: 90
dependsOn: npm_stable
displayName: Npm publish dev version
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main') # Only publish -dev on main branch.
pool:
name: azsdk-pool-mms-win-2022-general
vmImage: windows-2022

variables:
TYPESPEC_SKIP_DOCUSAURUS_BUILD: true # Disable docusaurus build

steps:
- checkout: self
submodules: true

- template: ./templates/install.yml
parameters:
nodeVersion: "20.x"

- template: ./templates/build.yml

- script: node ./core/packages/internal-build-utils/cmd/cli.js bump-version-preview .
displayName: Bump version to prerelease targets

- pwsh: |
echo "Updating config"
pnpm config set '//registry.npmjs.org/:_authToken' '${NPM_AUTH_TOKEN}'
echo "Publishing"
pnpm -r --filter='./packages/*' publish --access public --no-git-checks --tag next
name: Publish
env:
NPM_AUTH_TOKEN: $(azure-sdk-npm-token)
- template: /eng/pipelines/templates/variables/globals.yml@self
stages:
- stage: CI
pool:
name: $(WINDOWSPOOL)
image: $(WINDOWSVMIMAGE)
os: windows
jobs:
- job: npm_stable
timeoutInMinutes: 90
displayName: Npm publish

variables:
TYPESPEC_SKIP_DOCUSAURUS_BUILD: true # Disable docusaurus build

steps:
- checkout: self
submodules: true

- template: /eng/pipelines/templates/install.yml@self
parameters:
nodeVersion: "20.x"

- template: /eng/pipelines/templates/build.yml@self

- script: pnpm run test-official
displayName: Test

- template: /eng/pipelines/templates/upload-coverage.yml@self

- script: pnpm run pack:all
displayName: Pack packages

- pwsh: |
echo "Updating config"
pnpm config set '//registry.npmjs.org/:_authToken' '${NPM_AUTH_TOKEN}'
echo "Publishing"
pnpm chronus publish "./temp/artifacts/*.tgz" --access public --engine npm --report-summary ./publish-summary.json
name: Publish
env:
NPM_AUTH_TOKEN: $(azure-sdk-npm-token)
- script: |
echo "Publish summary:"
cat ./publish-summary.json
displayName: Log publish summary
- script: pnpm chronus-github create-releases --repo azure/typespec-azure --publish-summary ./publish-summary.json
displayName: Create github releases
env:
GITHUB_TOKEN: $(azuresdk-github-pat)

- task: AzureCLI@1
displayName: "Publish bundled packages to package storage"
inputs:
azureSubscription: "Azure SDK Engineering System"
scriptLocation: inlineScript
inlineScript: node ./eng/scripts/upload-bundler-packages.js

- task: AzureCLI@1
displayName: "Publish Azure playground"
inputs:
azureSubscription: "Azure SDK Engineering System"
scriptLocation: inlineScript
inlineScript: |
az storage blob upload-batch ^
--destination $web ^
--account-name "cadlplayground" ^
--destination-path cadl-azure/ ^
--source "./packages/typespec-azure-playground-website/dist/" ^
--overwrite
- job: npm_preview
timeoutInMinutes: 90
dependsOn: npm_stable
displayName: Npm publish dev version
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main') # Only publish -dev on main branch.

variables:
TYPESPEC_SKIP_DOCUSAURUS_BUILD: true # Disable docusaurus build

steps:
- checkout: self
submodules: true

- template: /eng/pipelines/templates/install.yml@self
parameters:
nodeVersion: "20.x"

- template: /eng/pipelines/templates/build.yml@self

- script: node ./core/packages/internal-build-utils/cmd/cli.js bump-version-preview .
displayName: Bump version to prerelease targets

- pwsh: |
echo "Updating config"
pnpm config set '//registry.npmjs.org/:_authToken' '${NPM_AUTH_TOKEN}'
echo "Publishing"
pnpm -r --filter='./packages/*' publish --access public --no-git-checks --tag next
name: Publish
env:
NPM_AUTH_TOKEN: $(azure-sdk-npm-token)
20 changes: 11 additions & 9 deletions eng/pipelines/jobs/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@ parameters:
type: string
- name: dotnetVersion
type: string
- name: poolName
- name: osName
type: string

steps:
- checkout: self
submodules: true

- template: ../templates/install.yml
- template: /eng/pipelines/templates/install.yml
parameters:
nodeVersion: ${{ parameters.nodeVersion }}

# Only running UI test on linux
- ${{ if ne(variables['Agent.OS'], 'Windows_NT') }}:
- template: ../templates/install-browsers.yml
- template: /eng/pipelines/templates/install-browsers.yml

- script: pnpm run check-version-mismatch
displayName: Check version mismatch

- template: ../templates/build.yml
- template: /eng/pipelines/templates/build.yml

- script: pnpm run test-official
displayName: Test

- template: ../templates/upload-coverage.yml
- template: /eng/pipelines/templates/upload-coverage.yml

- script: pnpm run check-format
displayName: Check Formatting
Expand Down Expand Up @@ -62,7 +62,7 @@ steps:
testResultsFiles: "*/test-results.xml"
mergeTestResults: true
failTaskOnFailedTests: false
testRunTitle: "[CORE] Test os: ${{ parameters.poolName }}, node: ${{ parameters.nodeVersion }}"
testRunTitle: "[CORE] Test os: ${{ parameters.osName }}, node: ${{ parameters.nodeVersion }}"
displayName: Publish core test results
condition: always()

Expand All @@ -73,12 +73,14 @@ steps:
testResultsFiles: "*/test-results.xml"
mergeTestResults: true
failTaskOnFailedTests: false
testRunTitle: "[NON-CORE] Test os: ${{ parameters.poolName }}, node: ${{ parameters.nodeVersion }}"
testRunTitle: "[NON-CORE] Test os: ${{ parameters.osName }}, node: ${{ parameters.nodeVersion }}"
displayName: Publish non-core test results
condition: always()

# Disable for now as e2e test are disabled - REMOVE BEFORE MERGING
# - publish: ./core/packages/playground-website/test-results
# artifact: "uitestresults-${{ parameters.poolName }}-node-${{ parameters.nodeVersion }}"
# - task: 1ES.PublishPipelineArtifact@1
# displayName: Publish UI tests artifacts
# condition: ne(variables['Agent.OS'], 'Windows_NT')
# inputs:
# path: : ./core/packages/playground-website/test-results
# artifact: "uitestresults-${{ parameters.osName }}-node-${{ parameters.nodeVersion }}"
10 changes: 6 additions & 4 deletions eng/pipelines/e2e-job.yml → eng/pipelines/jobs/e2e-job.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
jobs:
- job: e2e

pool:
name: azsdk-pool-mms-ubuntu-2004-general
vmImage: ubuntu-20.04
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux

variables:
TYPESPEC_VS_CI_BUILD: true # Enable official Visual Studio extension build
Expand All @@ -12,9 +14,9 @@ jobs:
- checkout: self
submodules: true

- template: ./templates/install.yml
- template: /eng/pipelines/templates/install.yml

- template: ./templates/build.yml
- template: /eng/pipelines/templates/build.yml
parameters:
nodeVersion: "20.x"

Expand Down
15 changes: 9 additions & 6 deletions eng/pipelines/jobs/publish-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ jobs:
TYPESPEC_SKIP_DOCUSAURUS_BUILD: true # Disable docusaurus build

pool:
name: azsdk-pool-mms-ubuntu-2004-general
vmImage: ubuntu-20.04
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux

steps:
- checkout: self
submodules: true

- template: ../templates/install.yml
- template: /eng/pipelines/templates/install.yml
parameters:
nodeVersion: "20.x"
- template: ../templates/build.yml
- template: /eng/pipelines/templates/build.yml

- script: node ./core/packages/internal-build-utils/cmd/cli.js bump-version-pr . --pr $(System.PullRequest.PullRequestNumber) --buildNumber $(Build.BuildNumber)
displayName: Bump version to prerelease targets
Expand All @@ -29,6 +30,8 @@ jobs:
- script: pnpm run pack:all
displayName: Pack packages

- publish: $(Build.SourcesDirectory)/temp/artifacts
artifact: packages
- task: 1ES.PublishPipelineArtifact@1
displayName: Publish packages(.tgz) as pipeline artifacts
inputs:
path: $(Build.SourcesDirectory)/common/temp/artifacts/packages
artifact: packages
Loading

0 comments on commit 909ed30

Please sign in to comment.