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

ENH: Add initial new project workflow #302

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

Conversation

meoflynn
Copy link
Collaborator

Initial workflow for creating an external project in a new domain. Updated the create_project method to include option for domain id and added new domain to user_domains

Description:

Special Notes:


Submitter:

Have you (where applicable):

  • Added unit tests?
  • Checked the latest commit runs on Dev?
  • Updated the example config file(s) and README?

Reviewer

Does this PR:

  • Place non-StackStorm code into the lib directory?
  • Have unit tests for the action/sensor and lib layers?
  • Have clear and obvious action parameter names and descriptions?

Initial workflow for creating an external project in a new domain.
Updated the create_project method to include option for domain id and
added new domain to user_domains
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.27%. Comparing base (0a23b1c) to head (52db645).
Report is 29 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #302      +/-   ##
==========================================
+ Coverage   98.15%   98.27%   +0.11%     
==========================================
  Files         126      130       +4     
  Lines        4599     4917     +318     
  Branches      244      255      +11     
==========================================
+ Hits         4514     4832     +318     
  Misses         76       76              
  Partials        9        9              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@meoflynn
Copy link
Collaborator Author

The icinga file is only in the PR when I fixed the formatting of the files in my branch

@meoflynn meoflynn force-pushed the jasmin-project-workflow branch from 2677196 to 98e203c Compare January 24, 2025 11:43
Pylint was showing errors, formatting the files
@meoflynn meoflynn force-pushed the jasmin-project-workflow branch from 98e203c to f21c68f Compare January 24, 2025 11:46
Add missing unit test for when we have an empty list for admin users
Updated jasmin project workflow method to have jasmin users as a
mandatory param
Project creation action gets the domain name from the user, add a step
in openstack_project to get the id for that given domain to use. The
create project method only takes the id for a domain.
@dataclass
class ProjectDetails:
name: str
email: str
description: str = ""
domain: str = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

domain: Optional[str] = None

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There's an edit I do in the openstack_project where we need to take a domain id as a required parameter - this is because the openstacksdk doesn't pass the parent id as a domain id so we would need to differentiate between the domains for the projects

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have a feature branch for the internal project and external project workflow that I'm working on as well that take domain as a parameter (as the domain is a new field in the project creation action)

Comment on lines +45 to +46
number_of_floating_ips: int = 1,
number_of_security_group_rules: int = 200,
Copy link
Collaborator

Choose a reason for hiding this comment

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

both of these need Optional[int] type hinting

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This section isn't part of getting the initial workflow up - to be done in a separate PR (or built on this PR)

Copy link
Collaborator

Choose a reason for hiding this comment

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

TBH I think we should drop these args across the board and hardcode them to whatever ops say rather than passing them as args everywhere
Instead we should make quota changes using the dedicated action later on and start with sensible defaults

It's out of scope for this PR but I'd like to do a follow-on PR that nukes this everywhere

Comment on lines +70 to +71
if not admin_user_list:
admin_user_list = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can write this more concise
admin_user_list = admin_user_list or []

Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't this a direct copy of create_external_project?
Maybe we could just modify that to accept both generic and jasmin external projects?

The only thing I can see changing is using Jasmin users instead of STFC ones and maybe some more bespoke networking rules

I guess it's fine for now since we're under a deadline - but something to think about

Copy link
Collaborator Author

@meoflynn meoflynn Jan 28, 2025

Choose a reason for hiding this comment

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

The initial plan was to take a copy of the existing external project workflow and set up the skeleton workflow we need and the implementation of the full workflow will be built on top of it (we need to check the networking workflow section here for this specific project type)

Follows from code suggestion in PR review
In the current draft PR for updating project creation action the
variable to set the domain for a project to be created in is
project_domain, not domain. Updated the domain variable to be
project_domain in workflow
@meoflynn meoflynn marked this pull request as ready for review January 31, 2025 10:54
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.

4 participants