forked from angel-quality/githubdemo
-
Notifications
You must be signed in to change notification settings - Fork 1
137 lines (122 loc) · 5.52 KB
/
snowpipe.yml
File metadata and controls
137 lines (122 loc) · 5.52 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# This is a basic workflow to help you get started with Actions
name: ServiceNow CI/CD Pipeline with QualityClouds LiveCheck
on:
pull_request:
push:
branches:
- master
jobs:
build:
# Purpose of this job is to Apply Remote Changes for the branch triggering
# the pipeline build to the Dev instance, then publish the application to
# app repo using the template versioning format.
name: Publish from Dev
runs-on: ubuntu-latest
# Below line can be used to set conditionals for modifying your pipeline as needed.
# if: ${{ github.event_name == 'pull_request'}}
steps:
- name: ServiceNow CI/CD Apply Changes
uses: ServiceNow/sncicd-apply-changes@1.0.0
env:
snowUsername: ${{ secrets.SN_USERNAME }}
snowPassword: ${{ secrets.SN_PASSWORD }}
snowSourceInstance: ${{ secrets.SN_DEV_INSTANCE }}
appSysID: ${{ secrets.SN_APP_SYSID }}
- name: ServiceNow CI/CD Publish App
id: publish_app
uses: ServiceNow/sncicd-publish-app@1.0.0
with:
versionTemplate: 1.1
versionFormat: template
# Optional, add +X to version number. Default: 1
# incrementBy: X
env:
snowUsername: ${{ secrets.SN_USERNAME }}
snowPassword: ${{ secrets.SN_PASSWORD }}
snowSourceInstance: ${{ secrets.SN_DEV_INSTANCE }}
appSysID: ${{ secrets.SN_APP_SYSID }}
# This is required to pass the version number output from Publish App
# to the input for Install App in the next job! This is because the jobs
# run on different Linux instances, so without this Install App won't know
# what to install.
outputs:
publishversion: ${{ steps.publish_app.outputs.newVersion }}
test:
# Purpose of this job is to Install App from the app repo for the version
# published in the build job to a Test instance, then run an ATF Test Suite
# associated with the app. If Test Suite fails, the app should be Rolled Back
# to clean up the persistent Test environment.
needs: build
name: Run ATF in Test
runs-on: ubuntu-latest
# Below line can be used to set conditionals for modifying your pipeline as needed.
# if: ${{ github.event_name == 'pull_request'}}
steps:
- name: ServiceNow CI/CD Install App
id: install_app
uses: ServiceNow/sncicd-install-app@1.0.0
with:
version: ${{ needs.build.outputs.publishversion }}
# Only applicable if Application Customization is active.
# Version of the base application on which to apply the customizations
baseAppVersion: '1.2.3'
# Only applicable if Application Customization is active and the associated
# application is a higher version than the currently installed version
# Default: false
autoUpgradeBaseApp: true
env:
snowUsername: ${{ secrets.SN_USERNAME }}
snowPassword: ${{ secrets.SN_PASSWORD }}
snowInstallInstance: ${{ secrets.SN_TEST_INSTANCE }}
appSysID: ${{ secrets.SN_APP_SYSID }}
- name: ServiceNow CI/CD Run ATF Test Suite
uses: ServiceNow/sncicd-tests-run@1.0.0
with:
testSuiteSysId: ${{ secrets.SN_ATFTESTSUITE_SYSID }}
env:
snowUsername: ${{ secrets.SN_USERNAME }}
snowPassword: ${{ secrets.SN_PASSWORD }}
snowInstallInstance: ${{ secrets.SN_TEST_INSTANCE }}
- name: ServiceNow CI/CD Rollback App
if: ${{ failure() && steps.install_app.outputs.rollbackVersion }}
uses: ServiceNow/sncicd-rollback-app@1.0.0
with:
version: ${{steps.install_app.outputs.rollbackVersion}}
env:
snowUsername: ${{ secrets.SN_USERNAME }}
snowPassword: ${{ secrets.SN_PASSWORD }}
snowInstallInstance: ${{ secrets.SN_TEST_INSTANCE }}
appSysID: ${{ secrets.SN_APP_SYSID }}
# This is required to pass the version number output from Publish App
# to the input for Install App in the next job! This is because the jobs
# run on different Linux instances, so without this Install App won't know
# what to install.
outputs:
publishversion: ${{ needs.build.outputs.publishversion }}
deployprod:
# Purpose of this job is to Install App to a Prod instance. This should only
# trigger if the feature branch has been merged to master after a successfully
# completed pull request, hence the conditional for push to master. In other words,
# the first two jobs run on CI, then all three jobs run on CD.
needs: test
name: Deploy to Prod
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- name: ServiceNow CI/CD Install App
id: install_app_prod
uses: ServiceNow/sncicd-install-app@1.0.0
with:
version: ${{ needs.test.outputs.publishversion }}
# Only applicable if Application Customization is active.
# Version of the base application on which to apply the customizations
baseAppVersion: '1.2.3'
# Only applicable if Application Customization is active and the associated
# application is a higher version than the currently installed version
# Default: false
autoUpgradeBaseApp: true
env:
snowUsername: ${{ secrets.SN_USERNAME }}
snowPassword: ${{ secrets.SN_PASSWORD }}
snowInstallInstance: ${{ secrets.SN_PROD_INSTANCE }}
appSysID: ${{ secrets.SN_APP_SYSID }}