Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/commands: report linting results base on repo name #15

Merged
merged 3 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
working_directory: testdata
dir_name: my-cool-project
dev_url: postgres://postgres:pass@localhost:5432/test?sslmode=disable
repo: "ariga/atlas-orb"
- atlas-orb/migrate_push:
working_directory: testdata
dir_name: my-cool-project
Expand All @@ -146,16 +147,19 @@ jobs:
dir_name: test-dir-sqlite
dir: "file://sqlite-broken-file"
dev_url: "sqlite://file.db?mode=memory"
repo: "ariga/atlas-orb"
- atlas-orb/migrate_lint:
working_directory: testdata
dir_name: test-dir-sqlite
dir: "file://sqlite-destructive"
dev_url: "sqlite://file.db?mode=memory"
repo: "ariga/atlas-orb"
- atlas-orb/migrate_lint:
working_directory: testdata
dir_name: test-dir-sqlite
dir: "file://sqlite-wrong-sum"
dev_url: "sqlite://file.db?mode=memory"
repo: "ariga/atlas-orb"
workflows:
test-deploy:
jobs:
Expand Down
11 changes: 5 additions & 6 deletions src/commands/migrate_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ parameters:
default: ''
description: |
The environment to use from the Atlas configuration file. For example, `dev`.
repo_url:
repo:
type: string
default: ''
description: |
The URL of the repository. If provided, linting results will be posted to the repository.
Otherwise, the repo url will based on your token type.
The repository name that linting results will be posted to.
github_token_env:
type: env_var_name
default: GITHUB_TOKEN
Expand All @@ -64,9 +63,9 @@ steps:
INPUT_VARS: <<parameters.vars>>
INPUT_DEV_URL: <<parameters.dev_url>>
command: |
# replace CIRCLE_REPOSITORY_URL with the repo_url if provided
if [ -n "<<parameters.repo_url>>" ]; then
CIRCLE_REPOSITORY_URL=<<parameters.repo_url>>
# replace CIRCLE_PROJECT_REPONAME with the repo if provided
if [ -n "<<parameters.repo>>" ]; then
CIRCLE_PROJECT_REPONAME=<<parameters.repo>>
datdao marked this conversation as resolved.
Show resolved Hide resolved
fi
# replace GITHUB_TOKEN with the github_token_env if provided
if [ -n "${<<parameters.github_token_env>>}" ]; then
Expand Down
43 changes: 23 additions & 20 deletions src/examples/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,31 @@ description: >
usage:
version: 2.1
orbs:
atlas-orb: ariga/[email protected]
atlas-orb: ariga/[email protected]
jobs:
push-dir:
docker:
- image: cimg/base:current
- image: cimg/postgres:16.2
environment:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: pass
steps:
- checkout
- atlas-orb/setup:
version: "latest"
cloud_token_env: "ATLAS_TOKEN"
- atlas-orb/migrate_lint:
dir_name: my-cool-project
dev_url: "postgres://postgres:pass@localhost:5432/postgres?sslmode=disable"
repo: "ariga/atlas-orb"
github_token_env: "GITHUB_TOKEN"
- atlas-orb/migrate_push:
dir_name: my-cool-project
dev_url: postgres://postgres:pass@localhost:5432/postgres?sslmode=disable
workflows:
postgres-example:
jobs:
- push-dir:
context: the-context-has-ATLAS_TOKEN
docker:
- image: cimg/base:current
- image: cimg/postgres:16.2
environment:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: pass
steps:
- checkout
- atlas-orb/setup:
version: "latest"
cloud_token_env: "ATLAS_TOKEN"
- atlas-orb/migrate_lint:
dir_name: my-cool-project
dev_url: "postgres://postgres:pass@localhost:5432/postgres?sslmode=disable"
github_token_env: "GITHUB_TOKEN"
- atlas-orb/migrate_push:
dir_name: my-cool-project
dev_url: postgres://postgres:pass@localhost:5432/postgres?sslmode=disable