-
Notifications
You must be signed in to change notification settings - Fork 357
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
Bidirectional Sync docs #7515
Merged
Merged
Bidirectional Sync docs #7515
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f542bb9
init
forstisabella 960ea01
bidirectional sync
forstisabella d134937
[netlify-build]
forstisabella 4cc6eb1
Apply suggestions from code review [netlify-build]
forstisabella 42fb426
fix incorrectly rendered callout
forstisabella f049c7e
Apply suggestions from code review
forstisabella File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,45 @@ 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 only applies changes from pull requests that you successfully merge. | ||
forstisabella marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Bidirectional sync only supports: | ||
- Explicit values (secrets require additional configuration) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to link to the secrets section here?
forstisabella marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- [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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
> 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 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. | ||
forstisabella marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Use bidirectional sync | ||
forstisabella marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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 `@@<secret_name>@@` 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 | ||
|
||
Git Connections enable Segment to sync data with your preferred Git repository through supported like SSH and token-based authentication. | ||
|
@@ -114,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. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change the last sentence please? Segment won't apply changes that are merged, only those that the user explicitly accepts by commenting
segment apply
so might be a little bit misleading? The flow is as follows: