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 a provider for scheduled pipelines #81

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

Conversation

sulami
Copy link

@sulami sulami commented May 17, 2022

This works structurally mostly like environment variables, but uses
schedule IDs as internal IDs.

Some hackery has been performed to make organization ID inheritance
from provider settings work. It does work correctly for the most part,
though local state can get a bit confused if the provider setting gets
changed. Explicit organizations on schedules work just fine though.

The scheduled actor ID in this is one of several magic IDs that we
have at CircleCI, and I can guarantee to remain stable.

CRUD operations have been verified to work off the local tree, and
import of existing schedules works as well.

Some provider-side validation is being performed, though it's much
easier to just let the operation fail and print out the API error
message, rather than duplicating all validation we perform in the API
here. An example here is the project<>schedule-name uniqueness
constraint, which is not checked in the provider. Similarly the
requirement for either a branch or tag to be set as part of
parameters, which is actually due to change soon.

Fixes #59.

matches := strings.Split(slug, "/")

if len(matches) != 3 {
return "", "", "", fmt.Errorf("Splitting project-slug '%s' into vcs/org/project failed", slug)
Copy link

Choose a reason for hiding this comment

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

I feel like this error message counters itself. Maybe something along the lines of Extracting vcs, org, and project from project-slug '%s' failed? As it stands now it seems to imply that it's being split INTO vcs/org/project rather than the values being extracted

This works structurally mostly like environment variables, but uses
schedule IDs as internal IDs.

Some hackery has been performed to make organization ID inheritance
from provider settings work. It does work correctly for the most part,
though local state can get a bit confused if the provider setting gets
changed. Explicit organizations on schedules work just fine though.

The scheduled actor ID in this is one of several magic IDs that we
have at CircleCI, and I can guarantee to remain stable.

CRUD operations have been verified to work off the local tree, and
import of existing schedules works as well.

Some provider-side validation is being performed, though it's much
easier to just let the operation fail and print out the API error
message, rather than duplicating all validation we perform in the API
here. An example here is the project<>schedule-name uniqueness
constraint, which is not checked in the provider. Similarly the
requirement for either a branch or tag to be set as part of
parameters, which is actually due to change soon.
@virgofx
Copy link

virgofx commented Aug 31, 2022

Would love to see support for scheduled pipelines. Any ETA on this?

@sulami
Copy link
Author

sulami commented Sep 19, 2022 via email

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] - new resource - schedule
4 participants