You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/functions/environment.md
+54Lines changed: 54 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,61 @@ If you're editing an existing function, you can **Save** changes without changin
52
52
53
53
When you deploy your destination function in your workspace, you fill out the settings on the destination configuration page, similar to how you would configure a normal destination.
54
54
55
+
## Functions Versioning
55
56
57
+
With Functions Versioning, you can access a complete change history for each source or destination function. View version history and creation details, then use a unified or split display to compare code and restore previous versions of a function.
58
+
59
+
> info "Functions Versioning in beta"
60
+
> Functions Versioning is in beta, and Segment is actively working on this feature. Some functionality may change before it becomes generally available. Versioning is disabled in workspaces where you deploy source functions with multiple instances. [Contact Segment](https://segment.com/help/contact/){:target="_blank"} with any feedback or questions.
61
+
62
+
63
+
### View and compare version history
64
+
65
+
To view the version history of a function:
66
+
1. Navigate to **Connections > Catalog > Functions**.
67
+
2. Select your source or destination function.
68
+
3. Select **Edit Function**, then click **Version history**.
69
+
70
+
Select previous versions to compare code using a *unified* or *split* view. With the split view, Segment displays the latest version on the left and the version you've selected on the right.
71
+
72
+
> success ""
73
+
> Unified and split compare screens are read-only. While you can copy code, you can't make changes directly from these screens.
74
+
75
+
#### `LATEST` and `DEPLOYED` versions
76
+
77
+
In the Version History panel, Segment displays `LATEST` and `DEPLOYED` labels that represent a function version state. You'll see the `LATEST` version at the top.
78
+
79
+
Segment labels a version as the `LATEST` when:
80
+
- You save a change to the function source code, but don't deploy the function at the same time.
81
+
- You [restore a previous version](#restore-a-previous-version) from your function's version history.
82
+
83
+
The `DEPLOYED` version is the function version that's currently deployed.
84
+
85
+
### Restore a previous version
86
+
87
+
To restore a previous function version:
88
+
89
+
1. Select the function you want to restore.
90
+
2. Click **Restore this version**.
91
+
- Segment creates a duplicate of the selected version and labels it as the `LATEST` version.
92
+
3. Click **Restore** on the confirmation screen.
93
+
4. To deploy the restored version, click **Save and Deploy** on the Source Code screen.
94
+
95
+
### Use Versioning with Segment's Public API
96
+
97
+
You can use Functions Versioning with Segment's [Public API](https://docs.segmentapis.com/tag/Functions){:target="_blank"} to retrieve version history records and source code, as well as to restore previous versions.
98
+
99
+
Here are some Public API use case examples:
100
+
101
+
**Get Version history**: Use the `/versions` endpoint to retrieve a list of version records and metadata of a certain page size. You can also use this endpoint to get version source code for a given version ID.
102
+
103
+
**Restore a previous version**: Use the `/restore` endpoint to restore a previous function version. This creates a new version with the same source as the version you are restoring.
104
+
105
+
**Create or update versions**: Create or update a function to add a version record and save the source code.
106
+
107
+
**Deploy a function**: Use the Public API to deploy a function. After you deploy, Segment marks the function version as `DEPLOYED`. Learn more about function version states [here](#latest-and-deployed-versions).
108
+
109
+
View Segment's [Public API](https://docs.segmentapis.com/tag/Functions){:target="_blank"} docs for more information on how to use Functions Versioning with the Public API.
0 commit comments