forked from opsgenie/opsgenie-cloudformation-resources
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitbucket-pipelines.yml
161 lines (144 loc) · 6.01 KB
/
bitbucket-pipelines.yml
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
clone:
depth: 10
image:
name: docker-public.packages.atlassian.com/atlassian/bitbucket-pipelines-mvn-python3-awscli:java11
pipelines:
custom:
Publish-Integration-Resource:
- variables:
- name: REGION
- step:
name: Build and Register Resource
oidc: true
script:
- cd opsgenie_integration
- export AWS_REGION=$REGION
- export AWS_ROLE_ARN=${ROLE_ARN}
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- export RESOURCE_NAME=Atlassian::Opsgenie::Integration
- export RESOURCE_PACKAGE=atlassian-opsgenie-integration
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- ../register-resource.sh
- step:
name: Run Contract Test
oidc: true
script:
- cd opsgenie_integration
- export AWS_REGION=$REGION
- export AWS_ROLE_ARN=${ROLE_ARN}
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- export RESOURCE_NAME=Atlassian::Opsgenie::Integration
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- ../script.sh
- ../test-check.sh
- step:
name: Publish Resource
oidc: true
trigger: manual
script:
- cd opsgenie_integration
- export AWS_REGION=$REGION
- export AWS_ROLE_ARN=${ROLE_ARN}
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- export RESOURCE_NAME=Atlassian::Opsgenie::Integration
- VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
- aws cloudformation publish-type --type RESOURCE --type-name $RESOURCE_NAME --public-version-number $VERSION
Publish-Team-Resource:
- variables:
- name: REGION
- step:
name: Build and Register Resource
oidc: true
script:
- cd opsgenie_team
- export AWS_REGION=$REGION
- export AWS_ROLE_ARN=${ROLE_ARN}
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- export RESOURCE_NAME=Atlassian::Opsgenie::Team
- export RESOURCE_PACKAGE=atlassian-opsgenie-team
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- ../register-resource.sh
- step:
name: Run Contract Test
oidc: true
script:
- cd opsgenie_team
- export AWS_REGION=$REGION
- export AWS_ROLE_ARN=${ROLE_ARN}
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- export RESOURCE_NAME=Atlassian::Opsgenie::Team
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- ../script.sh
- ../test-check.sh
- step:
name: Publish Resource
oidc: true
trigger: manual
script:
- cd opsgenie_integration
- export AWS_REGION=$REGION
- export AWS_ROLE_ARN=${ROLE_ARN}
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- export RESOURCE_NAME=Atlassian::Opsgenie::Team
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
- aws cloudformation publish-type --type RESOURCE --type-name $RESOURCE_NAME --public-version-number $VERSION
Publish-User-Resource:
- variables:
- name: REGION
- step:
name: Build and Register Resource
oidc: true
script:
- cd opsgenie_user
- export AWS_REGION=$REGION
- export AWS_ROLE_ARN=${ROLE_ARN}
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- export RESOURCE_NAME=Atlassian::Opsgenie::User
- export RESOURCE_PACKAGE=atlassian-opsgenie-user
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- ../register-resource.sh
- step:
name: Run Contract Test
oidc: true
script:
- cd opsgenie_user
- export AWS_REGION=$REGION
- export AWS_ROLE_ARN=${ROLE_ARN}
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- export RESOURCE_NAME=Atlassian::Opsgenie::User
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- ../script_with_delay.sh
- ../test-check.sh
- step:
name: Publish Resource
oidc: true
trigger: manual
script:
- cd opsgenie_integration
- export AWS_REGION=$REGION
- export AWS_ROLE_ARN=${ROLE_ARN}
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- export RESOURCE_NAME=Atlassian::Opsgenie::User
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
- aws cloudformation publish-type --type RESOURCE --type-name $RESOURCE_NAME --public-version-number $VERSION
Register-Publisher:
- variables:
- name: REGION
- step:
name: Build Resource and Register Resource
oidc: true
script:
- export AWS_REGION=$REGION
- export AWS_ROLE_ARN=${ROLE_ARN}
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- aws cloudformation register-publisher --connection-arn $CONNECTION_ARN --accept-terms-and-conditions
#TODO add new pipeline to deregister-type along with region parameter
pull-requests:
master:
- step:
Build Check:
- mvn package -B