Skip to content

Commit d93bfc5

Browse files
authored
Merge branch 'main' into task-programming-pod-templates-unit-testing
2 parents 493fd80 + 71ded8d commit d93bfc5

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed
450 KB
Loading
421 KB
Loading
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
title: Code Viewer
3+
weight: 2
4+
variants: -flyte -serverless -byoc +selfmanaged
5+
---
6+
7+
# Code Viewer
8+
The Union UI allows you to view the exact code that executed a specific task. Union securely transfers the [code bundle](../../user-guide/run-scaling/life-of-a-run.md/#phase-2-image-building) directly to your browser without routing it through the control plane.
9+
10+
![Code Viewer](../../_static/images/deployment/configuration/code-viewer/demo.png)
11+
12+
## Enable CORS policy on your fast registration bucket
13+
To support this feature securely, your bucket must allow CORS access from Union. The configuration steps vary depending on your cloud provider.
14+
15+
{{< tabs "bucket-cors-policy" >}}
16+
{{< tab "AWS S3 Console" >}}
17+
{{< markdown >}}
18+
1. Open the AWS Console.
19+
2. Navigate to the S3 dashboard.
20+
3. Select your fast registration bucket. By default, this is the same as the metadata bucket configured during initial deployment.
21+
4. Click the **Permissions** tab and scroll to **Cross-origin resource sharing (CORS)**.
22+
5. Click **Edit** and enter the following policy:
23+
![S3 CORS Policy](../../_static/images/deployment/configuration/code-viewer/s3.png)
24+
```
25+
[
26+
{
27+
"AllowedHeaders": [
28+
"*"
29+
],
30+
"AllowedMethods": [
31+
"GET",
32+
"HEAD",
33+
],
34+
"AllowedOrigins": [
35+
"https://*.unionai.cloud"
36+
],
37+
"ExposeHeaders": [
38+
"ETag"
39+
],
40+
"MaxAgeSeconds": 3600
41+
}
42+
]
43+
```
44+
For more details, see the [AWS S3 CORS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/cors.html).
45+
{{< /markdown >}}
46+
{{< /tab >}}
47+
{{< tab "Google GCS" >}}
48+
{{< markdown >}}
49+
Google Cloud Storage requires CORS configuration via the command line.
50+
51+
1. Create a `cors.json` file with the following content:
52+
```json
53+
[
54+
{
55+
"origin": ["https://*.unionai.cloud"],
56+
"method": ["HEAD", "GET"],
57+
"responseHeader": ["ETag"],
58+
"maxAgeSeconds": 3600
59+
}
60+
]
61+
```
62+
2. Apply the CORS configuration to your bucket:
63+
```bash
64+
gcloud storage buckets update gs://<fast_registration_bucket> --cors-file=cors.json
65+
```
66+
3. Verify the configuration was applied:
67+
```bash
68+
gcloud storage buckets describe gs://<fast_registration_bucket> --format="default(cors_config)"
69+
70+
cors_config:
71+
- maxAgeSeconds: 3600
72+
method:
73+
- GET
74+
- HEAD
75+
origin:
76+
- https://*.unionai.cloud
77+
responseHeader:
78+
- ETag
79+
```
80+
For more details, see the [Google Cloud Storage CORS documentation](https://docs.cloud.google.com/storage/docs/using-cors#command-line).
81+
{{< /markdown >}}
82+
{{< /tab >}}
83+
{{< tab "Azure Storage" >}}
84+
{{< markdown >}}
85+
For Azure Storage CORS configuration, see the [Azure Storage CORS documentation](https://learn.microsoft.com/en-us/rest/api/storageservices/cross-origin-resource-sharing--cors--support-for-the-azure-storage-services).
86+
{{< /markdown >}}
87+
{{< /tab >}}
88+
{{< /tabs >}}
89+
90+
## Troubleshooting
91+
92+
| Error Message | Cause | Fix |
93+
|---------------|-------|-----|
94+
| `Not available: No code available for this action.` | The task does not have a code bundle. This occurs when the code is baked into the Docker image or the task is not a code-based task. | This is expected behavior for tasks without code bundles. |
95+
| `Not Found: The code bundle file could not be found. This may be due to your organization's data retention policy.` | The code bundle was deleted from the bucket, likely due to a retention policy. | Review your fast registration bucket's retention policy settings. |
96+
| `Error: Code download is blocked by your storage bucket's configuration. Please contact your administrator to enable access.` | CORS is not configured on the bucket. | Configure CORS on your bucket using the instructions above. |

0 commit comments

Comments
 (0)