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

Add tags and skip_tags option to awx.awx.workflow_launch #15011

Merged

Conversation

Tompage1994
Copy link
Contributor

SUMMARY

The tags and skip_tags options were missing from the workflow_launch module so this PR adds them in.

resolves #15010

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • Collection
AWX VERSION
awx: 24.0.1.dev10+g8ac9045416
ADDITIONAL INFORMATION

The below snippet should now work where it didn't before.

- name: Kickoff workflow
  awx.awx.workflow_launch:
    name: wf_test
    wait: false
    skip_tags:
      - sometag
    tags:
      - mytag

@github-actions github-actions bot added component:awx_collection issues related to the collection for controlling AWX community labels Mar 19, 2024
@chrismeyersfsu
Copy link
Member

Do we need ask_skip_jobs_on_launch enabled on a workflow job template for the tags to be "accepted" on workflow job template launch?

@Tompage1994
Copy link
Contributor Author

Do we need ask_skip_jobs_on_launch enabled on a workflow job template for the tags to be "accepted" on workflow job template launch?

Yes it does, that's the same as other existing options for this module. These are all checked by this bit of code:

check_vars_to_prompts = {
'inventory': 'ask_inventory_on_launch',
'limit': 'ask_limit_on_launch',
'job_tags': 'ask_tags_on_launch',
'skip_tags': 'ask_skip_tags_on_launch',
'scm_branch': 'ask_scm_branch_on_launch',
}

The ask_tags_on_launch and ask_skip_tags_on_launch are already able to be set on the workflow_job_template module.

@fosterseth
Copy link
Member

fosterseth commented Mar 28, 2024

@Tompage1994 to make this more complete, and to prevent future regression, can you add a test for this?

you can add a new test case in file awx_collection/test/awx/test_workflow_job_template.py

the structure of the test would be similar to a regular job launch, just with workflows instead

https://github.com/fosterseth/awx/blob/8ddc19a927049b84f3f6bcfaae6595032f4a7789/awx_collection/test/awx/test_job_template.py#L110

the test would:

  1. use WorkflowJobTemplate.objects.create() to create a workflow template
  2. use run_module to launch the workflow, with job_tags and skip_tags specified
  3. use WorkflowJobTemplate.objects.get() to grab the newly created workflow job
  4. assert that the workflow job has the skip_tags and tags that you provided to the module

if you need some instructions for running the test locally just ping me and I'll provide some more instructions. Or you can just push your changes and let the CI run the test (albeit slow feedback loop)

@fosterseth fosterseth self-assigned this Mar 28, 2024
@Tompage1994 Tompage1994 force-pushed the collection/workflow_launch_options branch 5 times, most recently from 2215b7a to 757bb09 Compare April 2, 2024 15:40
@Tompage1994
Copy link
Contributor Author

@Tompage1994 to make this more complete, and to prevent future regression, can you add a test for this?

you can add a new test case in file awx_collection/test/awx/test_workflow_job_template.py

the structure of the test would be similar to a regular job launch, just with workflows instead

https://github.com/fosterseth/awx/blob/8ddc19a927049b84f3f6bcfaae6595032f4a7789/awx_collection/test/awx/test_job_template.py#L110

the test would:

  1. use WorkflowJobTemplate.objects.create() to create a workflow template
  2. use run_module to launch the workflow, with job_tags and skip_tags specified
  3. use WorkflowJobTemplate.objects.get() to grab the newly created workflow job
  4. assert that the workflow job has the skip_tags and tags that you provided to the module

if you need some instructions for running the test locally just ping me and I'll provide some more instructions. Or you can just push your changes and let the CI run the test (albeit slow feedback loop)

@fosterseth I have done this now

Signed-off-by: Tom Page <tpage@redhat.com>
@fosterseth fosterseth force-pushed the collection/workflow_launch_options branch from 2f5026f to 142004a Compare April 3, 2024 16:56
@fosterseth fosterseth merged commit c061f59 into ansible:devel Apr 3, 2024
21 checks passed
@fosterseth
Copy link
Member

@Tompage1994 thanks for improving the module!

djyasin pushed a commit to djyasin/awx that referenced this pull request Sep 16, 2024
djyasin pushed a commit to djyasin/awx that referenced this pull request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community component:awx_collection issues related to the collection for controlling AWX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing tags and skip_tags on awx.awx.workflow_launch module
3 participants