Skip to content

Commit 22aa1bf

Browse files
committed
增加了 test_login 单元测试
1 parent 64f6f7e commit 22aa1bf

File tree

1 file changed

+314
-0
lines changed

1 file changed

+314
-0
lines changed

.drone.yml

Lines changed: 314 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,314 @@
1+
---
2+
kind: pipeline
3+
type: docker
4+
name: Basic testing
5+
trigger:
6+
event:
7+
include:
8+
- push
9+
exclude:
10+
- pull_request
11+
12+
node:
13+
server: home
14+
arm: no
15+
docker: yes
16+
platform:
17+
os: linux
18+
arch: amd64
19+
20+
steps:
21+
- name: Build Image
22+
image: plugins/docker
23+
settings:
24+
dockerfile: Dockerfile
25+
pull_images: true
26+
repo: ghcr.io/gruberdev/freetf
27+
cache_from: ghcr.io/gruberdev/freetf
28+
registry: ghcr.io
29+
username: gruberdev
30+
password:
31+
from_secret: gh_token
32+
33+
- name: Terraform Plan
34+
image: ghcr.io/gruberdev/freetf:latest
35+
commands:
36+
- mkdir -p ~/.ssh-temp
37+
- chmod 700 ~/.ssh-temp
38+
- ssh-keygen -t rsa -b 4096 -C "[email protected]" -N 'test' -f ~/.ssh-temp/id_rsa
39+
- touch key.json && echo $$GOOGLE_CREDENTIALS >> key.json
40+
- export GOOGLE_APPLICATION_CREDENTIAL=key.json
41+
- terraform init -upgrade -reconfigure -force-copy
42+
- terraform plan
43+
environment:
44+
ARM_CLIENT_ID:
45+
from_secret: arm_id
46+
ARM_CLIENT_CERTIFICATE_PATH:
47+
from secret: azure_path
48+
ARM_CLIENT_CERTIFICATE_PASSWORD:
49+
from_secret: cte_password
50+
ARM_SUBSCRIPTION_ID:
51+
from_secret: azure_sub_id
52+
ARM_TENANT_ID:
53+
from_secret: azure_tenant_id
54+
GOOGLE_CREDENTIALS:
55+
from_secret: gcp_json
56+
GOOGLE_PROJECT:
57+
from_secret: google_cloud_projectid
58+
AWS_DEFAULT_REGION:
59+
from_secret: aws_default_region
60+
AWS_SECRET_ACCESS_KEY:
61+
from_secret: aws_account_secret
62+
AWS_ACCESS_KEY_ID:
63+
from_secret: aws_account_id
64+
depends_on:
65+
- Build Image
66+
67+
- name: Finished testing
68+
image: ghcr.io/gruberdev/freetf:latest
69+
commands:
70+
- echo "Finished basic setup!"
71+
depends_on:
72+
- Terraform Plan
73+
- Build Image
74+
75+
# - name: tfsec
76+
# image: tfsec/tfsec
77+
# commands:
78+
# - tfsec . -e GCP003,AWS044,GEN003
79+
# when:
80+
# status:
81+
# - success
82+
# - failure
83+
# event:
84+
# - push
85+
# - pull_request
86+
# environment:
87+
# GOOGLE_PROJECT:
88+
# from_secret: gcp_project_id
89+
# GOOGLE_KEY:
90+
# from_secret: gcp_default
91+
# AWS_DEFAULT_REGION:
92+
# from_secret: aws_region
93+
# AWS_SECRET_ACCESS_KEY:
94+
# from_secret: aws_key
95+
# AWS_ACCESS_KEY_ID:
96+
# from_secret: aws_id
97+
# - name: terrascan
98+
# image: accurics/terrascan
99+
# commands:
100+
# - terrascan scan
101+
# when:
102+
# status:
103+
# - success
104+
# - failure
105+
# event:
106+
# - push
107+
# - pull_request
108+
# - rollback
109+
# environment:
110+
# GOOGLE_PROJECT:
111+
# from_secret: gcp_project_id
112+
# GOOGLE_KEY:
113+
# from_secret: gcp_default
114+
# AWS_DEFAULT_REGION:
115+
# from_secret: aws_region
116+
# AWS_SECRET_ACCESS_KEY:
117+
# from_secret: aws_key
118+
# AWS_ACCESS_KEY_ID:
119+
# from_secret: aws_id
120+
# ---
121+
# kind: pipeline
122+
# type: docker
123+
# name: Amazon Web Services (AWS)
124+
# platform:
125+
# arch: amd64
126+
# depends_on:
127+
# - Basic testing
128+
# - Kickoff
129+
# trigger:
130+
# exclude:
131+
# - pull_request
132+
# include:
133+
# - push
134+
# branch:
135+
# exclude:
136+
# - renovate/*
137+
# include:
138+
# - main
139+
# - feature/aws_*
140+
# steps:
141+
# - name: Setup AWS
142+
# image: golang:1.16.6-alpine
143+
# commands:
144+
# - apk update && apk add curl && sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
145+
# - task init-drone
146+
# - task aws-init
147+
# environment:
148+
# AWS_DEFAULT_REGION:
149+
# from_secret: aws_region
150+
# AWS_SECRET_ACCESS_KEY:
151+
# from_secret: aws_key
152+
# AWS_ACCESS_KEY_ID:
153+
# from_secret: aws_id
154+
# - name: Unit Test EC2
155+
# image: golang:1.16.6-alpine
156+
# commands:
157+
# - apk update && apk add curl && sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
158+
# - task init-drone
159+
# - task unit-ec2-aws
160+
# depends_on:
161+
# - Setup AWS
162+
# environment:
163+
# AWS_DEFAULT_REGION:
164+
# from_secret: aws_region
165+
# AWS_SECRET_ACCESS_KEY:
166+
# from_secret: aws_key
167+
# AWS_ACCESS_KEY_ID:
168+
# from_secret: aws_id
169+
# - name: Unit Test RDS
170+
# image: golang:1.16.6-alpine
171+
# commands:
172+
# - apk update && apk add curl && sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
173+
# - task init-drone
174+
# - task unit-rds-aws
175+
# depends_on:
176+
# - Setup AWS
177+
# - Unit Test EC2
178+
# environment:
179+
# AWS_DEFAULT_REGION:
180+
# from_secret: aws_region
181+
# AWS_SECRET_ACCESS_KEY:
182+
# from_secret: aws_key
183+
# AWS_ACCESS_KEY_ID:
184+
# from_secret: aws_id
185+
# ---
186+
# kind: pipeline
187+
# type: docker
188+
# name: Google Cloud Provider (GCP)
189+
# platform:
190+
# arch: amd64
191+
# depends_on:
192+
# - Basic testing
193+
# - Kickoff
194+
# trigger:
195+
# exclude:
196+
# - pull_request
197+
# include:
198+
# - push
199+
# branch:
200+
# exclude:
201+
# - renovate/*
202+
# include:
203+
# - main
204+
# - feature/gcp_*
205+
# steps:
206+
# - name: Setup
207+
# image: golang:1.16.6-alpine
208+
# commands:
209+
# - apk update && apk add curl && sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
210+
# - task init-drone
211+
# environment:
212+
# GOOGLE_CREDENTIALS:
213+
# from_secret: gcp_key
214+
# GOOGLE_PROJECT:
215+
# from_secret: gcp_project_id
216+
217+
# - name: GCP Start Notification
218+
# image: appleboy/drone-discord
219+
# settings:
220+
# webhook_id:
221+
# from_secret: discord_id
222+
# webhook_token:
223+
# from_secret: discord_token
224+
# message: |-
225+
# Started GCP Pipeline on Drone CI.
226+
# Build number: {{build.number}}
227+
228+
# - name: Unit Compute
229+
# image: golang:1.16.6-alpine
230+
# commands:
231+
# - apk update && apk add curl && sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
232+
# - task init-drone
233+
# - task unit-compute-gcp
234+
# depends_on:
235+
# - Setup
236+
# environment:
237+
# GOOGLE_CREDENTIALS:
238+
# from_secret: gcp_key
239+
# GOOGLE_PROJECT:
240+
# from_secret: gcp_project_id
241+
242+
# - name: Unit Networking
243+
# image: golang:1.16.6-alpine
244+
# commands:
245+
# - apk update && apk add curl && sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
246+
# - task init-drone
247+
# - task unit-network-gcp
248+
# depends_on:
249+
# - Setup
250+
# environment:
251+
# GOOGLE_CREDENTIALS:
252+
# from_secret: gcp_key
253+
# GOOGLE_PROJECT:
254+
# from_secret: gcp_project_id
255+
256+
# # - name: Unit Bucket Storage
257+
# # image: golang:1.16.5-alpine
258+
# # commands:
259+
# # - apk update && apk add curl && sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
260+
# # - task init-drone
261+
# # - task unit-storage-gcp
262+
# # depends_on:
263+
# # - Setup
264+
# # - Unit Networking
265+
# # - Unit Compute
266+
# # environment:
267+
# # GOOGLE_CREDENTIALS:
268+
# # from_secret: gcp_key
269+
# # GOOGLE_PROJECT:
270+
# # from_secret: gcp_project_id
271+
272+
# - name: Testing has been sucessful
273+
# image: golang:1.16.6-alpine
274+
# commands:
275+
# - echo "Finished."
276+
# depends_on:
277+
# - Unit Networking
278+
# - Unit Compute
279+
# - Setup
280+
# environment:
281+
# GOOGLE_CREDENTIALS:
282+
# from_secret: gcp_key
283+
# GOOGLE_PROJECT:
284+
# from_secret: gcp_project_id
285+
286+
# ---
287+
# kind: pipeline
288+
# type: docker
289+
# name: Success Webhook Notification
290+
# platform:
291+
# arch: amd64
292+
# depends_on:
293+
# - Basic testing
294+
# - Kickoff
295+
# - Google Cloud Provider (GCP)
296+
# - Amazon Web Services (AWS)
297+
# trigger:
298+
# event:
299+
# include:
300+
# - push
301+
# exclude:
302+
# - pull_request
303+
# status:
304+
# - success
305+
# steps:
306+
# - name: Notification Webhook
307+
# image: appleboy/drone-discord
308+
# settings:
309+
# webhook_id:
310+
# from_secret: discord_id
311+
# webhook_token:
312+
# from_secret: discord_token
313+
# message: |-
314+
# Pipeline {{build.number}} has been sucessfully completed.

0 commit comments

Comments
 (0)