Skip to content

Commit

Permalink
[Pipelines] Migrate to 1ES pipeline. (#2474)
Browse files Browse the repository at this point in the history
* Initial template

* Add variables

* Update appcenter-cli-1ES.yml

* Add Ignored directory

* Remove unnecessary repo cloning

* Update dir

* Update dirs

* Supress value in tests

* Add supress

* Fix comments
  • Loading branch information
AnatolyPristensky authored Feb 26, 2024
1 parent 9930a9d commit b57d905
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 0 deletions.
128 changes: 128 additions & 0 deletions appcenter-cli-1ES.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
trigger: none

variables:
- name: API_TOKEN_KEY_VAULT
value: 'distributionStoresInt'
- name: API_TOKEN_KEY_VAULT_AZURE_SUBSCRIPTION
value: 'App Center - INT'

resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
pool:
name: 1ES-PT-CBL-Mariner-2.0-Gen2
os: linux
customBuildTags:
- ES365AIMigrationTooling-BulkMigrated
sdl:
sourceAnalysisPool: 1ES-PT-Windows-2022
stages:
- stage: Stage
jobs:
- job: HostJob
templateContext:
outputs:
- output: pipelineArtifact
displayName: "Publish Artifact: artifacts"
path: '$(Build.ArtifactStagingDirectory)/npm'
artifactName: npm

steps:
- task: NodeTool@0
inputs:
versionSpec: '14.x'
displayName: 'Install Node.js'

- script: |
npm ci
npm run build
displayName: 'Install and build'
- script: |
npm run test:ci || [ -f './test-results.xml' ]
displayName: 'Run CLI tests (with JUnit output)'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'test-results.xml'
searchFolder: '$(Build.SourcesDirectory)'
failTaskOnFailedTests: true
testRunTitle: 'CLI unit tests'
displayName: 'Verify CLI unit test result'

- script: |
npm ci
npm run build
displayName: 'Install and build appcenter-file-upload-client-node'
workingDirectory: $(Build.SourcesDirectory)/appcenter-file-upload-client-node
- script: |
npm run test:ci || [ -f './test-results.xml' ]
displayName: 'Run appcenter-file-upload-client-node tests'
workingDirectory: $(Build.SourcesDirectory)/appcenter-file-upload-client-node
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'test-results.xml'
searchFolder: '$(Build.SourcesDirectory)/appcenter-file-upload-client-node'
failTaskOnFailedTests: true
testRunTitle: 'appcenter-file-upload-client-node unit tests'
displayName: 'Verify appcenter-file-upload-client-node unit test result'

- task: AzureKeyVault@1
inputs:
azureSubscription: '$(API_TOKEN_KEY_VAULT_AZURE_SUBSCRIPTION)'
KeyVaultName: '$(API_TOKEN_KEY_VAULT)'
SecretsFilter: 'ac-cli-account-api-token'

- task: PowerShell@2
inputs:
filePath: '$(Build.SourcesDirectory)/test/functional/Invoke-FunctionalTests.ps1'
arguments: '-Token $(ac-cli-account-api-token)'
pwsh: true
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Run functional tests'

- script: |
[ -f './test/functional/testresult.xml' ]
displayName: 'Verify that functional test result file exists'
workingDirectory: $(Build.SourcesDirectory)
- task: PublishTestResults@2
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: 'testresult.xml'
searchFolder: '$(Build.SourcesDirectory)/test/functional'
failTaskOnFailedTests: true
testRunTitle: 'Functional tests'
displayName: 'Verify functional test result'

- script: |
npm pack
npm install -g appcenter-cli*.tgz
displayName: 'Package appcenter-cli'
workingDirectory: $(Build.SourcesDirectory)
- task: DeleteFiles@1
inputs:
contents: node_modules
displayName: 'Delete node_modules'

- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)'
includeRootFolder: false
archiveType: 'tar'
archiveFile: '$(Build.ArtifactStagingDirectory)/npm/$(Build.BuildId).tgz'
replaceExistingArchive: true
verbose: true
displayName: 'Prepare npm artifact'
2 changes: 2 additions & 0 deletions test/util/token-store/osx-keychain-parser-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("storing complete data in keychain", function () {
const keychain = tokenStore.createOsxTokenStore();

const testUser = "appcenter-user";
//[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="this is not a secret")]
const testPassword = "Sekret!";
const testTokenId = "1234abcd";

Expand Down Expand Up @@ -49,6 +50,7 @@ describe("storing data without a tokenId in keychain", function () {
const keychain = tokenStore.createOsxTokenStore();

const testUser = "appcenter-user";
//[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="this is not a secret")]
const testPassword = "Sekret!";

before(() => {
Expand Down

0 comments on commit b57d905

Please sign in to comment.