Skip to content

feat: remove workflow-name org scoping #1414

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

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

migmartri
Copy link
Member

@migmartri migmartri commented Oct 19, 2024

This patch allows users to create workflows with the same name in the same org as long as they are in different projects.

It also enforces now the requirement of passing project name during attestation and updates documentation and dagger module.

go run main.go wf ls
┌────────┬─────────┬────────────┬────────┬─────────────┬─────────────────┬─────────────────────┐
│ NAME   │ PROJECT │ CONTRACT   │ PUBLIC │ RUNNER      │ LAST RUN STATUS │ CREATED AT          │
├────────┼─────────┼────────────┼────────┼─────────────┼─────────────────┼─────────────────────┤
│ build  │ p2      │ p2-build   │ false  │ Unspecified │ success         │ 19 Oct 24 14:29 UTC │
│ build  │ p1      │ p1-build   │ false  │ Unspecified │ initialized     │ 19 Oct 24 14:29 UTC │
go run main.go wf create --name build --project p2
ERR duplicated: workflow "build" in project "p2" already exists

closes #1375

@migmartri migmartri requested review from jiparis and javirln October 19, 2024 14:51
@migmartri migmartri changed the title feat: remove workflow-name org scopping feat: remove workflow-name org scoping Oct 19, 2024
@@ -0,0 +1,2 @@
-- Modify "workflows" table
ALTER TABLE "workflows" ALTER COLUMN "project" SET NOT NULL;
Copy link
Member

Choose a reason for hiding this comment

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

We don't need a migration of previous workflows right?

Copy link
Member Author

Choose a reason for hiding this comment

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

No because they happened to be set and forced in another layer.

@@ -35,7 +35,7 @@ type Workflow struct {
func (Workflow) Fields() []ent.Field {
return []ent.Field{
field.String("name").Immutable(),
field.String("project").Optional(),
field.String("project"),
Copy link
Member

Choose a reason for hiding this comment

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

What are we doing with the current data? Will we migrate it?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no need to migrate since all fields, in fact, have a project name, enforced somewhere else in the stack, not in the DB until now

@migmartri migmartri merged commit ecaf8c2 into chainloop-dev:main Oct 21, 2024
14 checks passed
@migmartri migmartri deleted the 1375-require-project-name branch October 21, 2024 09:05
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.

feat: make workflow project scoped
3 participants