-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmigrate_lint.yml
More file actions
80 lines (79 loc) · 2.93 KB
/
Copy pathmigrate_lint.yml
File metadata and controls
80 lines (79 loc) · 2.93 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
description: >
This command lints the migration directory before pushing to Atlas Cloud.
parameters:
dir:
type: string
default: ""
description: |
The URL of the migration directory to lint. For example: file://migrations.
Read more about [Atlas URLs](https://atlasgo.io/concepts/url)
dir_name:
type: string
description: |
The name (slug) of the project in Atlas Cloud.
tag:
type: string
default: ""
description: |
The tag of migrations to used as base for linting. By default, the `latest` tag is used.
dev_url:
type: string
default: ''
description: |
The URL of the dev-database to use for analysis. For example: mysql://root:pass@localhost:3306/dev.
Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).
config:
type: string
default: ''
description: |
The path to the Atlas configuration file. By default, Atlas will look for a file named `atlas.hcl` in the current directory.
For example, `file://config/atlas.hcl`. Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).
vars:
type: string
default: ''
description: |
Stringify JSON object containing variables to be used inside the Atlas configuration file. For example: '{"var1": "value1", "var2": "value2"}'
working_directory:
type: string
default: "."
description: |
The working directory to run from. Defaults to project root.
env:
type: string
default: ''
description: |
The environment to use from the Atlas configuration file. For example, `dev`.
github_repo_env:
type: env_var_name
default: GITHUB_REPOSITORY
description: |
The repository name that linting results will be posted to.
github_token_env:
type: env_var_name
default: GITHUB_TOKEN
description: |
Environment variable containing the GitHub token.
If provided, the command will authenticate to GitHub.
(e.g. `GITHUB_TOKEN`)
steps:
- run:
name: Lint migrations and report results to Atlas Cloud
environment:
ATLAS_INPUT_WORKING_DIRECTORY: <<parameters.working_directory>>
ATLAS_INPUT_DIR_NAME: <<parameters.dir_name>>
ATLAS_INPUT_TAG: <<parameters.tag>>
ATLAS_INPUT_DIR: <<parameters.dir>>
ATLAS_INPUT_CONFIG: <<parameters.config>>
ATLAS_INPUT_ENV: <<parameters.env>>
ATLAS_INPUT_VARS: <<parameters.vars>>
ATLAS_INPUT_DEV_URL: <<parameters.dev_url>>
command: |
# replace GITHUB_REPOSITORY with the github_repo_env if provided
if [ -n "${<<parameters.github_repo_env>>}" ]; then
GITHUB_REPOSITORY=${<<parameters.github_repo_env>>}
fi
# replace GITHUB_TOKEN with the github_token_env if provided
if [ -n "${<<parameters.github_token_env>>}" ]; then
GITHUB_TOKEN=${<<parameters.github_token_env>>}
fi
atlasaction --action migrate/lint