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

Multi profiles #19

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

Multi profiles #19

wants to merge 19 commits into from

Conversation

pdenning
Copy link

As discussed in https://forum.stackstorm.com/t/pack-configs-different-hosts-credentials/398

This adds multi profile support to the jira pack actions.
Sensor is not changed.

Copy link
Contributor

@blag blag left a comment

Choose a reason for hiding this comment

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

This is coming along nicely, but it can be simplified quite a bit.

The configuration allows for multi jira definitions. This will allow for the automation to multiple Jira instances from a single stackstorm instance.

Profiles are defined within the ``profile`` section of the configuration and they accept the same parameters as the inline options.
This option takes in an array of profile options.
Copy link
Contributor

Choose a reason for hiding this comment

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

Using an array of profile dictionaries:

profiles:
- name: profile_one
  # ...
- name: profile_two
  # ...

is kind of clunky. Using a dictionary of profile dictionaries would be cleaner:

profiles:
  profile_one:
    # ...
  profile_two:
    # ...

Using a dictionary also means that you don't have to specify a default_profile - the inline values function as the default profile values.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed, I looked into this, but i wasn't sure how to define a dynamic key within the config schema file.
Could you point me in the right direction on how to define that and i'll look into changing it

Copy link
Contributor

@blag blag Dec 17, 2018

Choose a reason for hiding this comment

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

Oh gotcha. Dictionaries are called "objects" in JSONSchema.

My review comment later on contains a good example of what you can/should do. All you should need to do is:

  1. add the <<: &root_anchor after the --- line, before all of the existing keys
  2. indent the existing keys
  3. copy the profiles key from my example into config.schema.yaml

Let me know if you have any further questions - this is easily the most confusing part of a pack.

Copy link
Author

Choose a reason for hiding this comment

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

I saw your example below, i did implement it. However it appears there is a bug.

If i try and use an encrypted key store, it ignores the secret value and doesn't decrypt the password.
This happens when using anchors or not.

Copy link
Author

Choose a reason for hiding this comment

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

I have merged my changes. However there still appears to be a bug with secret key values. Maybe i am missing something you'll noticed

Copy link
Contributor

Choose a reason for hiding this comment

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

Does st2kv.system.jira_prod_pass get decrypted?

Copy link
Author

Choose a reason for hiding this comment

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

@blag
Yes the jira_prod_pass gets decrypted, however jira_dev_pass doesnt.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pdenning Sorry I don't have more to update, but at this point I believe this isn't working due to an undiscovered bug in StackStorm. I haven't had time to reproduce the issue or add a similar config to StackStorm's test fixtures yet, but I haven't forgotten about it.

If you managed to get it working, then please resolve this conversation, but if not I'd like to fix the bug in StackStorm itself (st2 repo) before we merge this PR.

Copy link
Member

@cognifloyd cognifloyd Apr 8, 2021

Choose a reason for hiding this comment

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

I found the bug. In order to decrypt the key, the schema needs to declare secret: true, BUT, the config loader does not look at any schemas under additionalProperties, so the profiles object is effectively schema-less:
https://github.com/StackStorm/st2/blob/8496bb2407b969f0937431992172b98b545f6756/st2common/st2common/util/config_loader.py#L133-L137

Copy link
Member

Choose a reason for hiding this comment

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

I'm working on a fix for this here: StackStorm/st2#5225

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
actions/attach_file_to_issue.py Outdated Show resolved Hide resolved
actions/lib/base.py Outdated Show resolved Hide resolved
actions/lib/base.py Outdated Show resolved Hide resolved
actions/lib/base.py Outdated Show resolved Hide resolved
actions/lib/base.py Show resolved Hide resolved
config.schema.yaml Outdated Show resolved Hide resolved
config.schema.yaml Outdated Show resolved Hide resolved
jira.yaml.example Outdated Show resolved Hide resolved
@arm4b
Copy link
Member

arm4b commented Aug 1, 2019

To close the loop on this. @pdenning @blag are we good to merge it? Are there any blockers or everything works as expected?

@blag
Copy link
Contributor

blag commented Aug 2, 2019

@armab No, this isn't working as expected and I still need to get to the bottom of it.

@CLAassistant
Copy link

CLAassistant commented May 11, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 3 committers have signed the CLA.

❌ Ragnra
❌ paul-denning
❌ pdenning
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants