From f2781ef934993253aff4c41ca0b2b2b7c3464b41 Mon Sep 17 00:00:00 2001 From: Will Russell Date: Tue, 12 Nov 2024 17:03:49 +0000 Subject: [PATCH] fix: add git sync and push namespacefiles example --- .../docs/05.concepts/02.namespace-files.md | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/content/docs/05.concepts/02.namespace-files.md b/content/docs/05.concepts/02.namespace-files.md index d7897cf36b..543dbbf141 100644 --- a/content/docs/05.concepts/02.namespace-files.md +++ b/content/docs/05.concepts/02.namespace-files.md @@ -88,6 +88,53 @@ tasks: The `Execute` button allows you to run your flow directly from the Code Editor. Click on the `Execute` button to run your flow. You should then see the Execution being created in a new browser tab and once you navigate to the `Logs` tab, you should see a friendly message ``Hello from the Editor!`` in the logs. +### PushNamespaceFiles and SyncNamespaceFiles Tasks + +There's 2 tasks to help you automatically manage your namespace files with Git. This allows you to sync the latest changes from a Git repository. + +This example will push Namespace Files you already have in Kestra to a Git repository for you: + +```yaml +id: push_to_git +namespace: system + +tasks: + - id: commit_and_push + type: io.kestra.plugin.git.PushNamespaceFiles + username: git_username + password: "{{ secret('GITHUB_ACCESS_TOKEN') }}" + url: https://github.com/git_username/scripts + branch: dev + namespace: company.team + files: + - "example.py" + gitDirectory: _files + commitMessage: "add namespace files" + dryRun: true +``` + +This example will sync Namespace Files inside of a Git repository to your Kestra instance: + +```yaml +id: sync_files_from_git +namespace: system + +tasks: + - id: sync_files + type: io.kestra.plugin.git.SyncNamespaceFiles + username: git_username + password: "{{ secret('GITHUB_ACCESS_TOKEN') }}" + url: https://github.com/git_username/scripts + branch: main + namespace: git + gitDirectory: _files + dryRun: true +``` + +Check out the dedicated guides for more information: +- [PushNamespaceFiles](../15.how-to-guides/pushnamespacefiles.md) +- [SyncNamespaceFiles](../15.how-to-guides/syncnamespacefiles.md) + ### GitHub Actions CI/CD You can leverage our official GitHub Action called [deploy-action](https://github.com/kestra-io/deploy-action) to synchronize your Git repository with a given namespace. This is useful if you want to orchestrate complex Python modules, dbt projects, Terraform or Ansible infrastructure, or any other project that contains code and configuration files with potentially multiple nested directories and files. @@ -121,7 +168,6 @@ jobs: When creating a service account role for the GitHub Action in the [Enterprise Edition](../06.enterprise/index.md), you need to grant the `FLOWS` permission to the Role. :: - ### Terraform Provider You can use the `kestra_namespace_file` resource from the official [Kestra Terraform Provider](https://registry.terraform.io/providers/kestra-io/kestra/latest/docs) to deploy all your custom script files from a specific directory to a given Kestra namespace.