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

monitor/schema: support using atlas hcl file in monitor action #299

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ronenlu
Copy link
Member

@ronenlu ronenlu commented Jan 9, 2025

No description provided.

Copy link

github-actions bot commented Jan 9, 2025

Atlas Lint Report

Analyzed migrations2

StatusStepResultDiagnostics
Detect New Migration FilesFound 0 new migration files (from 0 total)
Replay Migration FilesLoaded 0 changes on dev database
Connect your project to Atlas Cloud to get more safety checks

Migrations automatically reviewed by Atlas

Copy link

github-actions bot commented Jan 9, 2025

Atlas Lint Report

Analyzed migrations

StatusStepResultDiagnostics
Detect New Migration FilesFound 0 new migration files (from 0 total)
Replay Migration FilesLoaded 0 changes on dev database
Connect your project to Atlas Cloud to get more safety checks

Migrations automatically reviewed by Atlas

@ronenlu ronenlu force-pushed the monitor_hcl_config branch from 2cd0dcd to 5879762 Compare January 9, 2025 12:33
Copy link

github-actions bot commented Jan 9, 2025

atlas migrate lint on atlasaction/testdata/migrations_destructive

Status Step Result
1 new migration file detected 20230925192914.sql
ERD and visual diff generated View Visualization
Analyze 20230925192914.sql
1 reports were found in analysis
Destructive changes detected
Dropping table "t1" (DS102)
Read the full linting report on Atlas Cloud

Copy link

github-actions bot commented Jan 9, 2025

Atlas detected changes to the desired schema

Migration Plan (View on Atlas Cloud)

-- Create "t1" table
CREATE TABLE `t1` (
  `c1` integer NOT NULL
);
-- Create "t2" table
CREATE TABLE `t2` (
  `c1` integer NOT NULL
);
-- Create "t3" table
CREATE TABLE `t3` (
  `c1` integer NOT NULL,
  `c2` integer NOT NULL
);

Atlas lint results

Status Step Result
Detect schema changes3 new statements detected
No issues found

📝 Steps to edit this migration plan

1. Run the following command to pull the generated plan to your local workstation:

atlas schema plan pull --url "atlas://atlas-action/plans/pr-299-R1cGcSfo" > pr-299-R1cGcSfo.plan.hcl

2. Open pr-299-R1cGcSfo in your editor and modify it as needed. Note that the result of the plan should align
the database with the desired state. Otherwise, Atlas will report a schema drift.

3. Push the updated plan to the registry using the following command:

atlas schema plan push --pending --file pr-299-R1cGcSfo.plan.hcl

4. Re-trigger the schema/plan action to update this comment:

gh run rerun 12696781149

@ronenlu ronenlu force-pushed the monitor_hcl_config branch 2 times, most recently from 9bc2498 to 3ff18ce Compare January 9, 2025 12:55
@ronenlu ronenlu force-pushed the monitor_hcl_config branch from 3ff18ce to e8de595 Compare January 9, 2025 12:56
schema "main" {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to this pr, but integration of schema/test was failing:

image

@ronenlu ronenlu requested review from a8m, giautm and masseelch January 9, 2025 13:18
atlasaction/action.go Outdated Show resolved Hide resolved
atlasaction/action.go Outdated Show resolved Hide resolved
atlasaction/action.go Outdated Show resolved Hide resolved
@giautm giautm changed the title support using atlas hcl file in monitor action monitor/schema: support using atlas hcl file in monitor action Jan 9, 2025
@ronenlu ronenlu force-pushed the monitor_hcl_config branch from a5175b4 to 14ae5e8 Compare January 9, 2025 14:59
@ronenlu ronenlu requested review from giautm and masseelch January 9, 2025 15:00
atlasaction/action.go Outdated Show resolved Hide resolved
atlasaction/action.go Outdated Show resolved Hide resolved
@giautm
Copy link
Member

giautm commented Jan 9, 2025

You may need other inputs like extid, schemas and excludes from the config file

atlasaction/action.go Outdated Show resolved Hide resolved
Copy link
Member

@masseelch masseelch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires a specific version of Atlas, right? How can we ensure .RedactedURL does exist?

@masseelch
Copy link
Member

You may need other inputs like extid, schemas and excludes from the config file

I think in case the user decides to give us a custom config, all values should be provided in there, including exlcude pattersn and schema filter.

@ronenlu
Copy link
Member Author

ronenlu commented Jan 9, 2025

You may need other inputs like extid, schemas and excludes from the config file

I think in case the user decides to give us a custom config, all values should be provided in there, including exlcude pattersn and schema filter.

how we can ensure that all values are supplied?

@ronenlu
Copy link
Member Author

ronenlu commented Jan 9, 2025

This requires a specific version of Atlas, right? How can we ensure .RedactedURL does exist?

yes only works with latest version of atlas

@ronenlu ronenlu force-pushed the monitor_hcl_config branch from 14ae5e8 to 4aaba4e Compare January 9, 2025 15:53
@giautm
Copy link
Member

giautm commented Jan 9, 2025

You may need other inputs like extid, schemas and excludes from the config file

I think in case the user decides to give us a custom config, all values should be provided in there, including exlcude pattersn and schema filter.

how we can ensure that all values are supplied?

Instead of Generate the ID here (in atlas-action), we can add the function in Atlas-CLI to return this ID. So, we can get it via the inspect command too.

@ronenlu ronenlu force-pushed the monitor_hcl_config branch from 4aaba4e to 6a36d0f Compare January 9, 2025 19:01
@ronenlu ronenlu force-pushed the monitor_hcl_config branch from 6a36d0f to 306a612 Compare January 9, 2025 19:04
@ronenlu ronenlu requested review from masseelch and giautm January 9, 2025 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants