Skip to content

Commit ac91107

Browse files
committed
Add Functions Versioning content
1 parent d6e8095 commit ac91107

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

src/connections/functions/environment.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,60 @@ If you're editing an existing function, you can **Save** changes without changin
5252

5353
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.
5454

55+
## Functions Versioning
5556

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. [Contact Segment](https://segment.com/help/contact/){:target="_blank"} with any feedback or questions.
61+
62+
### View and compare version history
63+
64+
To view the version history of a function:
65+
1. Navigate to **Connections > Catalog > Functions**.
66+
2. Select your source or destination function.
67+
3. Select **Edit Function**, then click **Version history**.
68+
69+
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.
70+
71+
> success ""
72+
> Unified and split compare screens are read-only. While you can copy code, you can't make changes directly from these screens.
73+
74+
#### `LATEST` and `DEPLOYED` versions
75+
76+
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.
77+
78+
Segment labels a version as the `LATEST` when:
79+
- You save a change to the function source code, but don't deploy the function at the same time.
80+
- You [restore a previous version](#restore-a-previous-version) from your function's version history.
81+
82+
The `DEPLOYED` version is the function version that's currently deployed.
83+
84+
### Restore a previous version
85+
86+
To restore a previous function version:
87+
88+
1. Select the function you want to restore.
89+
2. Click **Restore this version**.
90+
- Segment creates a duplicate of the selected version and labels it as the `LATEST` version.
91+
3. Click **Restore** on the confirmation screen.
92+
4. To deploy the restored version, click **Save and Deploy** on the Source Code screen.
93+
94+
### Use Versioning with Segment's Public API
95+
96+
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.
97+
98+
Here are some Public API use case examples:
99+
100+
**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.
101+
102+
**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.
103+
104+
**Create or update versions**: Create or update a function to add a version record and save the source code.
105+
106+
**Deploy a function**: Use the Public API to deploy a function. After you deploy, Segment marks the function version as `DEPLOYED`. Learn more about [version states](#latest-and-deployed-versions).
107+
`
108+
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.
56109

57110
## Functions permissions
58111

0 commit comments

Comments
 (0)