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

Initial version #1

Merged
merged 23 commits into from
Feb 7, 2024
Merged

Initial version #1

merged 23 commits into from
Feb 7, 2024

Conversation

keturiosakys
Copy link
Member

@keturiosakys keturiosakys commented Jan 30, 2024

This PR creates a first version of a GitHub action that syncs the committed Fiberplane templates in a repo with your Fiberplane workspace.

The action requires at least the following inputs:

  • Fiberplane auth token (created with the CLI fp tokens create)
  • Workspace ID

The basic features are:

  • it watches a specified folder (default: .fiberplane/templates) for new/changed *.jsonnet files
  • it checks with the Fiberplane API if the templates already exist
  • for those that already exists it runs an fp update command, for those that don't - fp create

Some basic assumptions:

  • filenames are source of truth: they are the main item used for identifying templates between the git repo and the Fiberplane workspace
  • no deletion (yet): the workflow will not delete templates in your workspace if you delete them from your repo
  • no triggers: you can't use the action to add template triggers (webhook endpoints)

@keturiosakys keturiosakys changed the title WIP initial scaffold Initial version Feb 5, 2024
@keturiosakys keturiosakys marked this pull request as ready for review February 5, 2024 14:49
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
The `sync-templates` action accepts the following inputs:
- `api-token` (**required**) - the Fiberplane API token used to access the workspace
- `workspace-id` (**required**) - the ID of the workspace where the Templates should be sync'ed to
- `templates-directory` (optional) - directory where valid Templates `*.jsonnet` files are located, default: `.fiberplane/templates/`
Copy link
Member

Choose a reason for hiding this comment

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

I was thinking, maybe we should make the default without a . prefix. So something like fiberplane/templates/

To me a hidden directory is something that is secondary to the repo. For example having your own code is the primary use case of a application repo, but it might also contain a .github directory containing workflows. In the case of this action it will be run on a infrastructure like repo, where its main purpose is to store the templates.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't entirely agree here. I was actually thinking that the primary way this would be used would be per team / per project basis (kinda like hooks or workflows). Teams and/or projects might want to have project-specific templates attached in which case they become like a workflow associated with the repository code. Hence the .fiberplane/ prefix

Copy link
Member

Choose a reason for hiding this comment

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

I don't entirely agree here. I was actually thinking that the primary way this would be used would be per team / per project basis (kinda like hooks or workflows). Teams and/or projects might want to have project-specific templates attached in which case they become like a workflow associated with the repository code. Hence the .fiberplane/ prefix

This kinda goes against what is planned and what you mentioned earlier, that if a template is not defined in the directory then it should be deleted. Ie. the directory should match the templates that are created 1to1. If the idea is to have this in multiple directories than that workflow is not possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah that's a good point. I'm personally not yet entirely settled how the delete workflow should work but this is a good gotcha to keep in mind when we're discussing it

action.yml Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
action.yml Show resolved Hide resolved
Co-authored-by: Benno van den Berg <[email protected]>
@keturiosakys keturiosakys merged commit e35786a into main Feb 7, 2024
1 check passed
@keturiosakys keturiosakys deleted the initial branch February 7, 2024 13:17
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.

3 participants