From f542bb998162bff62a5d23b7a5dab517fd08f676 Mon Sep 17 00:00:00 2001 From: forstisabella <92472883+forstisabella@users.noreply.github.com> Date: Wed, 12 Mar 2025 16:55:40 -0400 Subject: [PATCH 1/6] init --- src/segment-app/extensions/git.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/segment-app/extensions/git.md b/src/segment-app/extensions/git.md index 04b87ed6c9..054233b0ee 100644 --- a/src/segment-app/extensions/git.md +++ b/src/segment-app/extensions/git.md @@ -4,9 +4,9 @@ title: Git Sync Extension Segment's Git extension lets you manage versioning by syncing changes you make in your Segment workspace to a Git repository. -Git Sync supports one-way synchronization from Segment to Git. This sync captures the current state of your workspace through a full sync and includes all new records and changes for supported resources. +Git Sync supports synchronization from Segment to Git. When you sync data from Segment to Git, you capture the current state of your workspace through a full sync and includes all new records and changes for supported resources. -Segment doesn't support syncing changes from Git back to Segment. +You can use [Bidirectional sync](#bidirectional-sync) to sync data from Git to Segment. After you enable bidirectional sync, Segment automatically listens for pull requests in your repository and manages all related workspace changes. ## Set up Git Sync @@ -84,6 +84,24 @@ To manage Segment resources using Git and Terraform, follow these steps: For more information on using Terraform, visit [Terraform's documentation](https://developer.hashicorp.com/terraform/docs){:target="_blank"}. +## Bidirectional Sync + +Bidirectional sync builds on top of the Git Sync extension and lets you manage your Segment workspace directly in GitHub. After you configure and enable bidirectional sync, Segment automatically listens for pull requests in your repository and manages all related workspace changes. Segment will not apply any changes unless the pull request is s[ecigfied pull request has met all mere requirements and the pull request is able to be merged. + +> warning "Bidirectional sync can lead to broad workspace changes, including data loss" +> When using bidirectional sync to manage your Segment resources, verify that your specified plan matches the changes you expected. Unexpected changes can include data loss. + +### Set up bidirectional sync + +To set up bidirectional sync in your workspace: +1. **Navigate to the Git Sync settings page to verify that your Git Sync integration is set up with Segment's GitHub App integration.** If it isn't, you can change the connection type under **Settings > Extensions > Git Sync > Manage Configuration**. If you were previously using the GitHub App integration, you might need to accept additional GitHub permissions that allow Segment t0 o listen for the relevant events. +2. **Add branch protection to your GitHub repository**. You can update your branch protections by opening GitHub and navigating to **Settings > Rules > Rulesets** and adding the Segment Extensions app to the **Bypass list**. +3. **Navigate to the Segment app and enable Git sync bidirectional sync.** From thje Segment app, navigate to **Settings > Edxtentions > Git Sync** page and enabling the **Git sync bidirectional sync** setting. + +### Use bidirectional sync + +1. Create a branch off of the branch specified in your Git Sync configuration, make the changes you'd like to see in your workspace, and submit a pull request with + ## Git Connections Git Connections enable Segment to sync data with your preferred Git repository through supported like SSH and token-based authentication. From 960ea0116a1c544b97ec9fc3b2bc2c89bdb05c46 Mon Sep 17 00:00:00 2001 From: forstisabella <92472883+forstisabella@users.noreply.github.com> Date: Fri, 21 Mar 2025 12:21:04 -0400 Subject: [PATCH 2/6] bidirectional sync --- src/segment-app/extensions/git.md | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/segment-app/extensions/git.md b/src/segment-app/extensions/git.md index 054233b0ee..dcabea41ca 100644 --- a/src/segment-app/extensions/git.md +++ b/src/segment-app/extensions/git.md @@ -86,7 +86,13 @@ For more information on using Terraform, visit [Terraform's documentation](https ## Bidirectional Sync -Bidirectional sync builds on top of the Git Sync extension and lets you manage your Segment workspace directly in GitHub. After you configure and enable bidirectional sync, Segment automatically listens for pull requests in your repository and manages all related workspace changes. Segment will not apply any changes unless the pull request is s[ecigfied pull request has met all mere requirements and the pull request is able to be merged. +Bidirectional sync builds on top of the Git Sync extension and lets you manage your Segment workspace directly in GitHub. After you configure and enable bidirectional sync, Segment automatically listens for pull requests in your repository and manages all related workspace changes. Segment will not apply any changes unless the pull request has met all merge requirements and can be merged. + +Bidirectional sync only supports: +- Explicit values (secrets require additional configuration) +- [Segment resources compatible with Git sync](#working-with-git-sync) + +Bidirectional sync does not support variables, references to other resources, or resources from other providers. > warning "Bidirectional sync can lead to broad workspace changes, including data loss" > When using bidirectional sync to manage your Segment resources, verify that your specified plan matches the changes you expected. Unexpected changes can include data loss. @@ -94,13 +100,28 @@ Bidirectional sync builds on top of the Git Sync extension and lets you manage y ### Set up bidirectional sync To set up bidirectional sync in your workspace: + 1. **Navigate to the Git Sync settings page to verify that your Git Sync integration is set up with Segment's GitHub App integration.** If it isn't, you can change the connection type under **Settings > Extensions > Git Sync > Manage Configuration**. If you were previously using the GitHub App integration, you might need to accept additional GitHub permissions that allow Segment t0 o listen for the relevant events. 2. **Add branch protection to your GitHub repository**. You can update your branch protections by opening GitHub and navigating to **Settings > Rules > Rulesets** and adding the Segment Extensions app to the **Bypass list**. -3. **Navigate to the Segment app and enable Git sync bidirectional sync.** From thje Segment app, navigate to **Settings > Edxtentions > Git Sync** page and enabling the **Git sync bidirectional sync** setting. +3. **Navigate to the Segment app and enable Git sync bidirectional sync.** From the Segment app, navigate to **Settings > Extentions > Git Sync** page and enabling the **Git sync bidirectional sync** setting. ### Use bidirectional sync -1. Create a branch off of the branch specified in your Git Sync configuration, make the changes you'd like to see in your workspace, and submit a pull request with +To apply changes to your workspace using bidirectional sync: + +1. Create a branch off of the branch specified in your Git Sync configuration, make the changes you'd like to see in your workspace, then submit a pull request with your changes. + - To add a new resource, add a *new* configuration file to the corresponding resource directory. Segment does not support multiple resources within the same file. The name does not matter, as it will be overwritten with a new ID after Segment creates the resource. +2. Segment calculates the changes required to reflect those changes and outputs the planned changes to a comment directly on the pull request. +3. Carefully double check that the planned changes match your desired changes and request approval from any stakeholders required before merging the pull request. +4. Run `segment apply` to apply the planned changes. + +#### Use secrets with bidirectional sync + +To use secrets in your bidirectional sync workflow: + +1. Navigate to **Settings > Extensions > Git Sync > Manage Configuration** and upload your secret to the **Secrets** table. +2. When referencing your secret, use `@@@@` in place of your secret, wherever applicable. Secrets are automatically hidden in a bidirectional sync output, but if you are not using them in a designated secret field, like Source/Destination key settings, for example, they might be written in plaintext to the repository as part of the regular syncing process. +3. Plan and apply the changes as usual. ## Git Connections From d134937fbbc2b071f606a63550a89c453389e790 Mon Sep 17 00:00:00 2001 From: forstisabella <92472883+forstisabella@users.noreply.github.com> Date: Fri, 21 Mar 2025 12:23:25 -0400 Subject: [PATCH 3/6] [netlify-build] --- src/segment-app/extensions/git.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/segment-app/extensions/git.md b/src/segment-app/extensions/git.md index dcabea41ca..4253e10efd 100644 --- a/src/segment-app/extensions/git.md +++ b/src/segment-app/extensions/git.md @@ -153,3 +153,4 @@ This error can occur if there are issues with your Git connection settings or pe - Your credentials have write access to the Git repository, as Segment requires this to sync changes. - Your repository is hosted by GitHub, GitLab, or Bitbucket (Segment doesn't support self-hosted repositories). - Branch protections are disabled on the repository. + From 4cc6eb1202953529199490e61e1a71afa6dcdee1 Mon Sep 17 00:00:00 2001 From: forstisabella <92472883+forstisabella@users.noreply.github.com> Date: Tue, 25 Mar 2025 09:46:27 -0400 Subject: [PATCH 4/6] Apply suggestions from code review [netlify-build] Co-authored-by: pwseg <86626706+pwseg@users.noreply.github.com> --- src/segment-app/extensions/git.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/segment-app/extensions/git.md b/src/segment-app/extensions/git.md index 4253e10efd..c85d2deb6c 100644 --- a/src/segment-app/extensions/git.md +++ b/src/segment-app/extensions/git.md @@ -6,7 +6,7 @@ Segment's Git extension lets you manage versioning by syncing changes you make i Git Sync supports synchronization from Segment to Git. When you sync data from Segment to Git, you capture the current state of your workspace through a full sync and includes all new records and changes for supported resources. -You can use [Bidirectional sync](#bidirectional-sync) to sync data from Git to Segment. After you enable bidirectional sync, Segment automatically listens for pull requests in your repository and manages all related workspace changes. +You can use [bidirectional sync](#bidirectional-sync) to sync data from Git to Segment. After you enable bidirectional sync, Segment automatically listens for pull requests in your repository and manages all related workspace changes. ## Set up Git Sync @@ -86,7 +86,7 @@ For more information on using Terraform, visit [Terraform's documentation](https ## Bidirectional Sync -Bidirectional sync builds on top of the Git Sync extension and lets you manage your Segment workspace directly in GitHub. After you configure and enable bidirectional sync, Segment automatically listens for pull requests in your repository and manages all related workspace changes. Segment will not apply any changes unless the pull request has met all merge requirements and can be merged. +Bidirectional sync builds on top of the Git Sync extension and lets you manage your Segment workspace directly in GitHub. After you configure and enable bidirectional sync, Segment automatically listens for pull requests in your repository and manages all related workspace changes. Segment only applies changes from pull requests that you successfully merge. Bidirectional sync only supports: - Explicit values (secrets require additional configuration) @@ -101,7 +101,7 @@ Bidirectional sync does not support variables, references to other resources, or To set up bidirectional sync in your workspace: -1. **Navigate to the Git Sync settings page to verify that your Git Sync integration is set up with Segment's GitHub App integration.** If it isn't, you can change the connection type under **Settings > Extensions > Git Sync > Manage Configuration**. If you were previously using the GitHub App integration, you might need to accept additional GitHub permissions that allow Segment t0 o listen for the relevant events. +1. **Navigate to the Git Sync settings page to verify that your Git Sync integration is set up with Segment's GitHub App integration.** If it isn't, you can change the connection type under **Settings > Extensions > Git Sync > Manage Configuration**. If you were previously using the GitHub App integration, you might need to accept additional GitHub permissions that allow Segment to listen for the relevant events. 2. **Add branch protection to your GitHub repository**. You can update your branch protections by opening GitHub and navigating to **Settings > Rules > Rulesets** and adding the Segment Extensions app to the **Bypass list**. 3. **Navigate to the Segment app and enable Git sync bidirectional sync.** From the Segment app, navigate to **Settings > Extentions > Git Sync** page and enabling the **Git sync bidirectional sync** setting. From 42fb426babb17d106d1e9512c6394ffd2bf5ea24 Mon Sep 17 00:00:00 2001 From: forstisabella <92472883+forstisabella@users.noreply.github.com> Date: Wed, 26 Mar 2025 13:20:06 -0400 Subject: [PATCH 5/6] fix incorrectly rendered callout --- src/segment-app/extensions/git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/segment-app/extensions/git.md b/src/segment-app/extensions/git.md index c85d2deb6c..359a5802ff 100644 --- a/src/segment-app/extensions/git.md +++ b/src/segment-app/extensions/git.md @@ -94,7 +94,7 @@ Bidirectional sync only supports: Bidirectional sync does not support variables, references to other resources, or resources from other providers. -> warning "Bidirectional sync can lead to broad workspace changes, including data loss" +> warning "Bidirectional sync can lead to broad workspace changes, including data loss" > When using bidirectional sync to manage your Segment resources, verify that your specified plan matches the changes you expected. Unexpected changes can include data loss. ### Set up bidirectional sync From f049c7e22e99972e01d16c552b3b3878c7863803 Mon Sep 17 00:00:00 2001 From: forstisabella <92472883+forstisabella@users.noreply.github.com> Date: Wed, 26 Mar 2025 13:20:32 -0400 Subject: [PATCH 6/6] Apply suggestions from code review Co-authored-by: Dean Huynh --- src/segment-app/extensions/git.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/segment-app/extensions/git.md b/src/segment-app/extensions/git.md index 359a5802ff..97b19156e4 100644 --- a/src/segment-app/extensions/git.md +++ b/src/segment-app/extensions/git.md @@ -86,10 +86,10 @@ For more information on using Terraform, visit [Terraform's documentation](https ## Bidirectional Sync -Bidirectional sync builds on top of the Git Sync extension and lets you manage your Segment workspace directly in GitHub. After you configure and enable bidirectional sync, Segment automatically listens for pull requests in your repository and manages all related workspace changes. Segment only applies changes from pull requests that you successfully merge. +Bidirectional sync builds on top of the Git Sync extension and lets you manage your Segment workspace directly in GitHub. After you configure and enable bidirectional sync, Segment automatically listens for pull requests in your repository and manages all related workspace changes. Segment only applies changes when you comment `segment apply` on pull requests that can be successfully merged. Bidirectional sync only supports: -- Explicit values (secrets require additional configuration) +- Explicit values ([secrets](#use-secrets-with-bidirectional-sync) require additional configuration) - [Segment resources compatible with Git sync](#working-with-git-sync) Bidirectional sync does not support variables, references to other resources, or resources from other providers. @@ -103,7 +103,7 @@ To set up bidirectional sync in your workspace: 1. **Navigate to the Git Sync settings page to verify that your Git Sync integration is set up with Segment's GitHub App integration.** If it isn't, you can change the connection type under **Settings > Extensions > Git Sync > Manage Configuration**. If you were previously using the GitHub App integration, you might need to accept additional GitHub permissions that allow Segment to listen for the relevant events. 2. **Add branch protection to your GitHub repository**. You can update your branch protections by opening GitHub and navigating to **Settings > Rules > Rulesets** and adding the Segment Extensions app to the **Bypass list**. -3. **Navigate to the Segment app and enable Git sync bidirectional sync.** From the Segment app, navigate to **Settings > Extentions > Git Sync** page and enabling the **Git sync bidirectional sync** setting. +3. **Navigate to the Segment app and enable Git sync bidirectional sync.** From the Segment app, navigate to **Settings > Extentions > Git Sync** page and enable the **Git sync bidirectional sync** setting. ### Use bidirectional sync