Skip to content

Instantly share code, notes, and snippets.

@jasper07
Created November 2, 2022 11:07
Show Gist options
  • Save jasper07/c8363cfb6a796edcca60175467fe8573 to your computer and use it in GitHub Desktop.
Save jasper07/c8363cfb6a796edcca60175467fe8573 to your computer and use it in GitHub Desktop.
azure devops pipeline for deploying to CF and uploading to CTMS
name: hello-world-app
resources:
containers:
- container: cfcli
image: 'ppiper/cf-cli'
options: --user 0:0 --privileged
trigger:
- master
stages:
- stage: Build
displayName: Build MTA for SAP Cloud Platform
jobs:
- job: build
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '16.x'
displayName: 'Install Node.js'
- script: npm install
displayName: 'npm install '
- script: npm run build
displayName: Build MTA
- script: npm test
displayName: Test applications
- publish: $(System.DefaultWorkingDirectory)/mta_archives/.
artifact: WebApp
- stage: Deploy
displayName: Deploy to SAP Cloud Platform
jobs:
- job: deploy
pool:
vmImage: 'ubuntu-latest'
container: cfcli
steps:
- download: current
artifact: WebApp
- bash: |
cf login -u "$(CF-USER)" -p "$(CF-PASSWORD)" -a "$(CF-API)" -o "$(CF-ORG)" -s "$(CF-SPACE)"
cf deploy $(Pipeline.Workspace)/WebApp/hello-world.mtar -f
- stage: Upload
displayName: Upload to CTMS
jobs:
- job: upload
pool:
vmImage: 'ubuntu-latest'
steps:
- download: current
artifact: WebApp
- task: NodeTool@0
inputs:
versionSpec: '16.x'
displayName: 'Install Node.js'
- script: npm install
displayName: 'npm install '
- script: npm run upload "$(Pipeline.Workspace)/WebApp/hello-world.mtar"
env:
CLIENT_ID : $(CLIENT_ID)
CLIENT_SECRET: $(CLIENT_SECRET)
USER_NAME: $(Build.RequestedForEmail)
displayName: Upload to CTMS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment