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

fix: save project settings in synthetics config #592

Merged
merged 4 commits into from
Sep 13, 2022

Conversation

vigneshshanmugam
Copy link
Member

@vigneshshanmugam vigneshshanmugam commented Sep 9, 2022

  • fix Error when pushing monitors from the CI environment #590
  • Changed the way how the Synthetics agent works with project monitor settings and how we can keep the settings idempotent when users run push on their local dev machine and also on the CI. Sparked out of discussion here - https://elastic.slack.com/archives/C022SU2U6DC/p1662556348346669
  • As a result, Introduced the project setting in the synthetics.config file instead of having yet another project.json file
    There was other way, we could have solved this using the same project.json and constructing them on demand and still be able to provide the same idempotentcy. But having them on the config file, has tons of advantages right now and also in the future.
    • Users can immediately see how the values like id, space and url values are filled in when they initialize the agent, instead of hidden under .synthetics folder.
    • Helps with code reviews, when one user change a given value, others can validate it before getting pushed from CI
    • This is the best one so far, it will allow us to support multiple projects in the long term with few lines of code and can be explicit about it.
    projects: [
      { id: 'uptime', tags: ['synthetics:ui'],space: 'synthetics',url: 'uptime-synthetics.kibana.com'},
      {id: 'apm',tags: ['apm:ui'],space: 'apm',url: 'apm-synthetics.kibana.com'},
    ]

Testing

  • Build the local project using - npm run build

Existing Synthetics project

  • We used project.json before where configuration were stored, Its removed from this PR, so you should see the CLI throwing error if you try to push from the repo.
  • Perform init again to reinitialize the project OR follow along the errors and set up required values in the config file.
  • Go to any existing scaffolded synthetics project using prior versions of the agent and try pushing to experience different errors. For this to work properly. You would need to link to the current synthetics version. You can do so by changing package.json to @elastic/synthetics: file:/path/to/locally/built/synthetics

Brand new synthetics project

  • Setup a brand new Synthetics project - node dist/cli.js init [optional-dir]
  • Follow along and check if project settings have been initialized properly
  • Validate by pushing with auth specified npm run push -- --auth <key>.

@apmmachine
Copy link
Collaborator

apmmachine commented Sep 9, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-09-09T18:40:16.669+0000

  • Duration: 14 min 53 sec

Test stats 🧪

Test Results
Failed 0
Passed 185
Skipped 2
Total 187

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

Copy link
Contributor

@andrewvc andrewvc left a comment

Choose a reason for hiding this comment

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

LGTM

@vigneshshanmugam vigneshshanmugam merged commit 49cd565 into elastic:main Sep 13, 2022
@vigneshshanmugam vigneshshanmugam deleted the project-settings branch September 13, 2022 19:22
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.

Error when pushing monitors from the CI environment
3 participants