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

feat: add support for --config option in push command #908

Merged
merged 1 commit into from Mar 28, 2024

Conversation

vigneshshanmugam
Copy link
Member

@vigneshshanmugam vigneshshanmugam commented Mar 27, 2024

  • Add support for Push command that was not handling the --config option correctly. This PR fixed that and allows users to push the same journeys under different projects using different configuration file.
> npx @elastic/synthetics push --config <synthetics.config.prod.ts>

> npx @elastic/synthetics push --config <synthetics.config.qa.ts>

@vigneshshanmugam vigneshshanmugam added the bug Something isn't working label Mar 27, 2024
@vigneshshanmugam vigneshshanmugam added enhancement New feature or request and removed bug Something isn't working labels Mar 27, 2024
@vigneshshanmugam vigneshshanmugam changed the title fix: handle --config correctly in push command feat: add support for --config option in push command Mar 27, 2024
Copy link
Contributor

@devcorpio devcorpio left a comment

Choose a reason for hiding this comment

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

LGTM

Testing setup

relevant content of my synthetics.config.ts file:

    monitor: {
      schedule: 5,
      locations: ['dev'] as any,
      privateLocations: [],
      tags: ['']
    },
    /**
     * Project monitors settings
     */
    project: {
      id: 'testear',
      url: 'http://kibana-server:5601/zpf/',
      space: 'default',

    },

relevant content of a new file named synthetics.config.devcorpio.ts file:

    /**
     * Configure global monitor settings
     */
    monitor: {
      schedule: 60,
      locations: ['dev'] as any,
      privateLocations: [],
      tags: ['devcorpio-test']
    },
    /**
     * Project monitors settings
     */
    project: {
      id: 'testear-devcorpio-test',
      url: 'http://kibana-server:5601/zpf/',
      space: 'default',
    },

Testing flow (npm users, don't forget to set the extra "--" when passing flags)

Execute the command: "npm run push -- --config synthetics.config.devcorpio.ts"

  • The results of executing that command in a branch WITHOUT the changes show:
before-change

We can see how schedule and project-id values are not taken from config.devcorpio.ts, as expected.

  • The results of executing that command in the branch of this PR shows the values of the new file:
Screenshot after

🎉

  • If I execute the push command without setting --config, it takes the default one 👍

@gsantoro
Copy link

I tested this and it works as expected.

I can push the same set of journeys (the same files) with two different configs for two different projects.

The two different push commands won't interfere with each other, and all parameters from the config files will be used correctly.

@vigneshshanmugam vigneshshanmugam merged commit 9494973 into elastic:main Mar 28, 2024
9 checks passed
@vigneshshanmugam vigneshshanmugam deleted the fix-push-config branch March 28, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants