-
Notifications
You must be signed in to change notification settings - Fork 5
147 lines (139 loc) · 4.67 KB
/
Copy pathtest.yml
File metadata and controls
147 lines (139 loc) · 4.67 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
138
139
140
141
142
143
144
145
146
147
name: Test AtlasCLI Action
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
MONGODB_ATLAS_PUBLIC_API_KEY: ${{ secrets.PUBLIC_API_KEY }}
MONGODB_ATLAS_PRIVATE_API_KEY: ${{ secrets.PRIVATE_API_KEY }}
MONGODB_ATLAS_ORG_ID: ${{ secrets.ORG_ID }}
MONGODB_ATLAS_PROJECT_ID: ${{ secrets.PROJECT_ID }}
MONGODB_ATLAS_OPS_MANAGER_URL: ${{ vars.CLOUD_DEV_URL }}
MONGODB_ATLAS_SILENCE_STORAGE_WARNING: "true"
jobs:
no-version:
name: Use AtlasCLI without version input
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup AtlasCLI without version input
uses: ./
- name: Use AtlasCLI
shell: bash
run: atlas --help
input-version:
name: Use AtlasCLI with version input
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup AtlasCLI with version input
uses: ./
with:
version: v1.9.0
- name: Use AtlasCLI
shell: bash
run: atlas --help
create-delete-project:
name: Create and delete project
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup AtlasCLI and create a project
id: create-project
uses: ./
with:
create-project-name: ${{ github.run_id }}-project1
- name: delete project
uses: ./
with:
delete-project-id: ${{ steps.create-project.outputs.create-project-id }}
create-delete-cluster:
name: Create and delete cluster
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup AtlasCLI and create a project
id: create-project
uses: ./
with:
create-project-name: ${{github.run_id}}-project2
- name: Create cluster
id: create-cluster
uses: ./
with:
create-cluster-name: test-cluster
project-id: ${{ steps.create-project.outputs.create-project-id }}
- name: Delete cluster and project
uses: ./
with:
delete-cluster-name: test-cluster
delete-project-id: ${{ steps.create-project.outputs.create-project-id }}
setup:
name: Setup and teardown afterwards
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup AtlasCLI and create a project
id: create-project
uses: ./
with:
create-project-name: ${{github.run_id}}-test-setup-project
- name: Setup
id: setup
uses: ./
with:
run-setup: true
project-id: ${{ steps.create-project.outputs.create-project-id }}
cluster-name: ${{github.run_id}}-cluster
username: ${{ secrets.CLUSTER_USERNAME }}
password: ${{ secrets.CLUSTER_PASSWORD }}
- name: Retrieve Connection String
shell: bash
run: |
echo "${{ steps.setup.outputs.connection-string }}"
- name: Teardown
uses: ./
with:
delete-project-id: ${{ steps.create-project.outputs.create-project-id }}
delete-cluster-name: ${{github.run_id}}-cluster
service-account-authentication:
name: Setup a Service Account and create a project
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Create a Service Account and get client ID and client secret
id: generate_sa
run: |
bash build/generate-service-account.sh
- name: Create a project
env:
MONGODB_ATLAS_PUBLIC_API_KEY: "" # Temporarily set to empty so that the action uses the client ID and client secret
MONGODB_ATLAS_PRIVATE_API_KEY: ""
MONGODB_ATLAS_CLIENT_ID: ${{ steps.generate_sa.outputs.client-id }}
MONGODB_ATLAS_CLIENT_SECRET: ${{ steps.generate_sa.outputs.client-secret }}
uses: mongodb/atlas-github-action@v0.2.0
id: create-project
with:
create-project-name: ${{ github.run_id }}-project3
- name: Delete a project
env:
MONGODB_ATLAS_PUBLIC_API_KEY: ""
MONGODB_ATLAS_PRIVATE_API_KEY: ""
MONGODB_ATLAS_CLIENT_ID: ${{ steps.generate_sa.outputs.client-id }}
MONGODB_ATLAS_CLIENT_SECRET: ${{ steps.generate_sa.outputs.client-secret }}
uses: mongodb/atlas-github-action@v0.2.0
with:
delete-project-id: ${{ steps.create-project.outputs.create-project-id }}
- name: Delete the Service Account
env:
CLIENT_ID: ${{ steps.generate_sa.outputs.client-id }}
run: |
bash build/terminate-service-account.sh