Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
altostra-orb: altostra/altostra-orb@1.1.1
Use altostra-orb
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Deploying a standard node project to your repo. Use the "setup" command to install and authenticate with your account. Use the "deploy" command to package and deploy the current project to your repo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
version: '2.1'
orbs:
altostra-orb: altostra/altostra-orb@x.y
jobs:
build-and-push:
docker:
- image: cimg/node:12.19
steps:
- checkout
- altostra-orb/setup
- install:
command: |
npm install
name: Install node modules
- altostra-orb/deploy:
env-name: Development
instance-name: MyInstance
working_directory: ~/repo
workflows:
use-my-orb:
jobs:
- build-and-push
Syncing and invalidating a static website project Use the "setup" command to install and authenticate with your account. Use the "sync" command to sync your new files to the s3 bucket Use the "invalidate" command to invalidate the existing CDN
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
version: '2.1'
orbs:
altostra-orb: altostra/altostra-orb@x.y
jobs:
sync-and-invalidate:
docker:
- image: cimg/node:12.19
steps:
- checkout
- altostra-orb/setup
- altostra-orb/sync:
all: true
instance-name: prod
public: true
- altostra-orb/invalidate:
all: true
instance-name: prod
working_directory: ~/repo
workflows:
use-my-orb:
jobs:
- sync-and-invalidate
Build, test and deploy a basic NodeJS project. This job runs `npm install`, `npm run build` and `npm run test`, and on success, runs `npm ci --production` and deploys the current project to the requested instance.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
env-name | The environment containing this instance | Yes | - | string |
image-name | Optional. Image name to use when pushing this version | No | '' | string |
instance-name | The instance this version will be deployed to | Yes | - | string |
node-version | Pick a specific circleci/node image variant: https://hub.docker.com/r/cimg/node/tags | No | '12.19' | string |
Push and deploy the current project
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
env-name | The environment to which to deploy | Yes | - | string |
image-name | Optional. The image name (i.e: 1.0.0, v2.4.1, alpha, dev, test, ...) | No | '' | string |
instance-name | The instance name to deploy | Yes | - | string |
Deploy the current project from an existing image
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
env-name | The environment to which to deploy | Yes | - | string |
image-name | The image name (i.e: 1.0.0, v2.4.1, ...) | Yes | - | string |
instance-name | The instance name to deploy | Yes | - | string |
Invalidate the CDN caches of the current project
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
all | Invalidate all the CDNs in the instance | No | true | boolean |
cdns | Invalidate only the given CDNs by name - spaces separated list | No | '' | string |
instance-name | The instance name to invalidate | Yes | - | string |
paths | The paths to invalidate. Default to all if not provided - spaces separated list | No | /* | string |
Push a new image of the current project
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
image-name | The image name (i.e: 1.0.0, v2.4.1, alpha, dev, test, ...) | Yes | - | string |
Install and authenticate with Altostra.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
api-token | Your Altostra API token from https://app.altostra.com/settings/tokens | No | ALTO_API_KEY | env_var_name |
Synchronize files to buckets of the current project
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
all | Sync all the buckets in the instance | No | true | boolean |
buckets | Sync only the given buckets by name - spaces separated list | No | '' | string |
instance-name | The instance name to sync | Yes | - | string |
public | Set public access to files after syncing - private by default | No | false | boolean |
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
Integrate Altostra projects into your CircleCI workflows. Use Altostra to accelerate serverless applications development in a no-code environment. To use this orb, sign up for a free account at https://altostra.com. Learn more: https://docs.altostra.com/integrations/ci-cd/circleci-integration.html
display:
home_url: https://www.altostra.com
source_url: https://github.com/altostra/altostra-orb
commands:
deploy:
description: Push and deploy the current project
parameters:
env-name:
description: The environment to which to deploy
type: string
image-name:
default: ""
description: 'Optional. The image name (i.e: 1.0.0, v2.4.1, alpha, dev, test, ...)'
type: string
instance-name:
description: The instance name to deploy
type: string
steps:
- when:
condition: << parameters.image-name >>
steps:
- run:
command: |
alto deploy "<< parameters.instance-name >>":"<< parameters.image-name >>" --env "<< parameters.env-name >>" --push --json
name: Deploying from image << parameters.image-name >> as instance << parameters.instance-name >> to environment << parameters.env-name >>
- unless:
condition: << parameters.image-name >>
steps:
- run:
command: |
alto deploy "<< parameters.instance-name >>" --env "<< parameters.env-name >>" --push --json
name: Deploying as instance << parameters.instance-name >> to environment << parameters.env-name >>
deploy-version:
description: Deploy the current project from an existing image
parameters:
env-name:
description: The environment to which to deploy
type: string
image-name:
description: 'The image name (i.e: 1.0.0, v2.4.1, ...)'
type: string
instance-name:
description: The instance name to deploy
type: string
steps:
- run:
command: |
alto deploy "<< parameters.instance-name >>":"<< parameters.image-name >>" --env "<< parameters.env-name >>" --json
name: Deploying from image << parameters.image-name >> as instance << parameters.instance-name >> to enviroment "<< parameters.env-name >>"
invalidate:
description: Invalidate the CDN caches of the current project
parameters:
all:
default: true
description: Invalidate all the CDNs in the instance
type: boolean
cdns:
default: ""
description: Invalidate only the given CDNs by name - spaces separated list
type: string
instance-name:
description: The instance name to invalidate
type: string
paths:
default: /*
description: The paths to invalidate. Default to all if not provided - spaces separated list
type: string
steps:
- when:
condition: << parameters.all >>
steps:
- run:
command: |
alto invalidate "<< parameters.instance-name >>" -a -p "<< parameters.paths >>" --json
name: Invalidating all CDNs for << parameters.instance-name >>
- unless:
condition: << parameters.all >>
steps:
- run:
command: |
alto sync "<< parameters.instance-name >>" "<< parameters.cdns >>" -p "<< parameters.paths >>" --json
name: Invalidating << parameters.cdns >> CDNs for << parameters.instance-name >>
push:
description: Push a new image of the current project
parameters:
image-name:
description: 'The image name (i.e: 1.0.0, v2.4.1, alpha, dev, test, ...)'
type: string
steps:
- run:
command: |
alto push << parameters.image-name >> --json
name: Push the image
setup:
description: |
Install and authenticate with Altostra.
parameters:
api-token:
default: ALTO_API_KEY
description: Your Altostra API token from https://app.altostra.com/settings/tokens
type: env_var_name
steps:
- run:
command: |
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
npm i -g @altostra/cli
alto api-key set ${<< parameters.api-token >>}
name: Install Altostra CLI and set the API token
sync:
description: Synchronize files to buckets of the current project
parameters:
all:
default: true
description: Sync all the buckets in the instance
type: boolean
buckets:
default: ""
description: Sync only the given buckets by name - spaces separated list
type: string
instance-name:
description: The instance name to sync
type: string
public:
default: false
description: Set public access to files after syncing - private by default
type: boolean
steps:
- when:
condition: << parameters.all >>
steps:
- run:
command: |
alto sync "<< parameters.instance-name >>" -a <<# parameters.public >> --public <</ parameters.public >> --json
name: Syncing all buckets to << parameters.instance-name >>
- unless:
condition: << parameters.all >>
steps:
- run:
command: |
alto sync "<< parameters.instance-name >>" "<< parameters.buckets >>" <<# parameters.public >> --public <</ parameters.public >> --json
name: Syncing << parameters.buckets >> buckets to << parameters.instance-name >>
jobs:
deploy-node-project:
description: |
Build, test and deploy a basic NodeJS project.
This job runs `npm install`, `npm run build` and `npm run test`,
and on success, runs `npm ci --production` and deploys the current project to the requested instance.
docker:
- image: cimg/node:<< parameters.node-version >>
parameters:
env-name:
description: The environment containing this instance
type: string
image-name:
default: ""
description: Optional. Image name to use when pushing this version
type: string
instance-name:
description: The instance this version will be deployed to
type: string
node-version:
default: "12.19"
description: 'Pick a specific circleci/node image variant: https://hub.docker.com/r/cimg/node/tags'
type: string
steps:
- checkout
- restore_cache:
keys:
- modules-cache-{{ checksum "package-lock.json" }}
- modules-cache
- setup
- run:
command: |
npm ci
npm run build
name: Install dependecies
- save_cache:
key: modules-cache-{{ checksum "package-lock.json" }}
paths:
- node_modules
- run:
command: |
npm run test
name: Run Tests
- run:
command: |
npm ci --production
name: Clean for Production
- deploy:
env-name: << parameters.env-name >>
image-name: << parameters.image-name >>
instance-name: << parameters.instance-name >>
examples:
deploy-node-project:
description: |
Deploying a standard node project to your repo. Use the "setup" command to install and authenticate with your account. Use the "deploy" command to package and deploy the current project to your repo
usage:
version: "2.1"
orbs:
altostra-orb: altostra/altostra-orb@x.y
jobs:
build-and-push:
docker:
- image: cimg/node:12.19
steps:
- checkout
- altostra-orb/setup
- install:
command: |
npm install
name: Install node modules
- altostra-orb/deploy:
env-name: Development
instance-name: MyInstance
working_directory: ~/repo
workflows:
use-my-orb:
jobs:
- build-and-push
sync-invalidate-website:
description: |
Syncing and invalidating a static website project Use the "setup" command to install and authenticate with your account. Use the "sync" command to sync your new files to the s3 bucket Use the "invalidate" command to invalidate the existing CDN
usage:
version: "2.1"
orbs:
altostra-orb: altostra/altostra-orb@x.y
jobs:
sync-and-invalidate:
docker:
- image: cimg/node:12.19
steps:
- checkout
- altostra-orb/setup
- altostra-orb/sync:
all: true
instance-name: prod
public: true
- altostra-orb/invalidate:
all: true
instance-name: prod
working_directory: ~/repo
workflows:
use-my-orb:
jobs:
- sync-and-invalidate