-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathpipeline-ci.yaml
111 lines (94 loc) · 2.75 KB
/
pipeline-ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: "$(Date:yyyy)-$(Date:MM)-$(Rev:r)"
pr:
- main
trigger:
batch: true
branches:
include:
- main
- feature/*
paths:
include:
- src/*
- tests/*
- prisma/*
pool:
vmImage: ubuntu-latest
jobs:
- job: build
displayName: Build
steps:
- task: CmdLine@2
displayName: 'Move .env file'
inputs:
script: mv $(Build.SourcesDirectory)/.env.example $(Build.SourcesDirectory)/.env
## Sekcja Artifacts i NPM
# - task: npmAuthenticate@0
# inputs:
# workingFile: .npmrc
# customEndpoint:
- task: DockerCompose@0
displayName: Run Docker-compose-up
inputs:
containerregistrytype: Container Registry
dockerComposeFile: $(Build.SourcesDirectory)/docker-compose.yaml
dockerComposeCommand: 'up -d'
- task: CmdLine@2
displayName: 'ls'
inputs:
script: ls -l $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: 'Move .env file with e2e payload'
inputs:
script: mv $(Build.SourcesDirectory)/.env.e2e $(Build.SourcesDirectory)/.env
- task: CmdLine@2
displayName: 'Check .env file'
inputs:
script: cat $(Build.SourcesDirectory)/.env
- task: UseNode@1
inputs:
version: '20.x'
checkLatest: true
- task: Npm@1
displayName: install dependencies
inputs:
command: 'install'
workingDir: '$(Build.SourcesDirectory)/'
- task: Npm@1
displayName: run test
inputs:
command: 'custom'
workingDir: '$(Build.SourcesDirectory)/'
customCommand: 'run test e2e'
## Sekcja Docker push
# - task: Docker@2
# displayName: Build and push an image to container registry
# inputs:
# command: buildAndPush
# repository: swapi-caching # efektywnie nazwa aplikacji
# dockerfile: $(Build.SourcesDirectory)/Dockerfile # wskazanie Dockerfile
# containerRegistry: acr-wg #nazwa Service Connection
# tags: |
# $(Build.BuildNumber) # tag, może być kilka
# latest
- job:
# https://blog.devgenius.io/create-work-item-on-pipeline-failure-in-azure-devops-yaml-pipeline-973bd175166
displayName: RaiseBug
dependsOn: Build
condition: failed()
steps:
- task: CmdLine@2
displayName: Install Azure DevOps Extension
inputs:
script: 'az extension add --name azure-devops'
- task: CmdLine@2
displayName: Configure Default Settings
inputs:
script: |
az devops configure --defaults organization=$(System.CollectionUri) project=$(System.TeamProject)
- task: CmdLine@2
displayName: Create Work Item
inputs:
script: 'az boards work-item create --title "Build $(Build.BuildNumber) failed" --type "Issue" --description "Build failure.<div>Pipeline Name - $(Build.DefinitionName)"'
env:
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)