Skip to content

Commit c715cf1

Browse files
committed
fix: format code with prettier and terraform fmt
Fixes CI formatting checks for the JFrog Xray module.
1 parent 132b900 commit c715cf1

File tree

3 files changed

+31
-31
lines changed

3 files changed

+31
-31
lines changed

registry/coder/modules/jfrog-xray/README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This module integrates JFrog Xray vulnerability scanning results into Coder work
3434
module "jfrog_xray" {
3535
source = "registry.coder.com/modules/jfrog-xray/coder"
3636
version = "1.0.0"
37-
37+
3838
resource_id = docker_container.workspace.id
3939
xray_url = "https://example.jfrog.io/xray"
4040
xray_token = var.jfrog_access_token
@@ -48,15 +48,15 @@ module "jfrog_xray" {
4848
module "jfrog_xray" {
4949
source = "registry.coder.com/modules/jfrog-xray/coder"
5050
version = "1.0.0"
51-
51+
5252
resource_id = docker_container.workspace.id
5353
xray_url = "https://example.jfrog.io/xray"
5454
xray_token = var.jfrog_access_token
55-
55+
5656
# Specify repo and path separately for more control
5757
repo = "docker-local"
5858
repo_path = "/codercom/enterprise-base:v2.1.0"
59-
59+
6060
display_name = "Container Security Scan"
6161
icon = "/icon/shield.svg"
6262
}
@@ -88,15 +88,15 @@ resource "docker_container" "workspace" {
8888
count = data.coder_workspace.me.start_count
8989
image = "example.jfrog.io/docker-local/codercom/enterprise-base:latest"
9090
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}"
91-
91+
9292
# Container configuration...
9393
}
9494
9595
# Add Xray vulnerability scanning
9696
module "jfrog_xray" {
9797
source = "registry.coder.com/modules/jfrog-xray/coder"
9898
version = "1.0.0"
99-
99+
100100
resource_id = docker_container.workspace[0].id
101101
xray_url = "https://example.jfrog.io/xray"
102102
xray_token = var.jfrog_access_token
@@ -106,16 +106,16 @@ module "jfrog_xray" {
106106

107107
## Variables
108108

109-
| Name | Description | Type | Default | Required |
110-
|------|-------------|------|---------|----------|
111-
| `resource_id` | The resource ID to attach the vulnerability metadata to | `string` | n/a | yes |
112-
| `xray_url` | The URL of the JFrog Xray instance | `string` | n/a | yes |
113-
| `xray_token` | The access token for JFrog Xray authentication | `string` | n/a | yes |
114-
| `image` | The container image to scan in format 'repo/path:tag' | `string` | n/a | yes |
115-
| `repo` | The JFrog Artifactory repository name (auto-extracted if not provided) | `string` | `""` | no |
116-
| `repo_path` | The repository path with image name and tag (auto-extracted if not provided) | `string` | `""` | no |
117-
| `display_name` | The display name for the vulnerability metadata section | `string` | `"Security Vulnerabilities"` | no |
118-
| `icon` | The icon to display for the vulnerability metadata | `string` | `"/icon/security.svg"` | no |
109+
| Name | Description | Type | Default | Required |
110+
| -------------- | ---------------------------------------------------------------------------- | -------- | ---------------------------- | -------- |
111+
| `resource_id` | The resource ID to attach the vulnerability metadata to | `string` | n/a | yes |
112+
| `xray_url` | The URL of the JFrog Xray instance | `string` | n/a | yes |
113+
| `xray_token` | The access token for JFrog Xray authentication | `string` | n/a | yes |
114+
| `image` | The container image to scan in format 'repo/path:tag' | `string` | n/a | yes |
115+
| `repo` | The JFrog Artifactory repository name (auto-extracted if not provided) | `string` | `""` | no |
116+
| `repo_path` | The repository path with image name and tag (auto-extracted if not provided) | `string` | `""` | no |
117+
| `display_name` | The display name for the vulnerability metadata section | `string` | `"Security Vulnerabilities"` | no |
118+
| `icon` | The icon to display for the vulnerability metadata | `string` | `"/icon/security.svg"` | no |
119119

120120
## Outputs
121121

@@ -124,7 +124,7 @@ This module creates workspace metadata that displays:
124124
- **Image**: The scanned container image
125125
- **Total Vulnerabilities**: Total count of all vulnerabilities
126126
- **Critical**: Count of critical severity vulnerabilities
127-
- **High**: Count of high severity vulnerabilities
127+
- **High**: Count of high severity vulnerabilities
128128
- **Medium**: Count of medium severity vulnerabilities
129129
- **Low**: Count of low severity vulnerabilities
130130

@@ -155,16 +155,19 @@ image = "docker-local/team/project/service:main-abc123"
155155
### Common Issues
156156

157157
**"No scan results found"**
158+
158159
- Verify the image exists in Artifactory
159160
- Check that Xray has scanned the image
160161
- Confirm the image path format is correct
161162

162163
**"Authentication failed"**
164+
163165
- Verify the access token is valid
164166
- Check token permissions include Xray read access
165167
- Ensure the Xray URL is correct
166168

167169
**"Module fails to apply"**
170+
168171
- Verify network connectivity to JFrog instance
169172
- Check Terraform provider versions
170173
- Review Coder logs for detailed error messages

registry/coder/modules/jfrog-xray/main.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { describe, expect, it } from "bun:test";
2-
import {
3-
runTerraformInit,
4-
testRequiredVariables,
5-
} from "~test";
2+
import { runTerraformInit, testRequiredVariables } from "~test";
63

74
describe("jfrog-xray", async () => {
85
await runTerraformInit(import.meta.dir);

registry/coder/modules/jfrog-xray/main.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ variable "icon" {
6060

6161
# Configure the Xray provider
6262
provider "xray" {
63-
url = var.xray_url
64-
access_token = var.xray_token
63+
url = var.xray_url
64+
access_token = var.xray_token
6565
check_license = false
6666
}
6767

6868
# Parse image components if repo and repo_path are not provided
6969
locals {
7070
# Split image into repo and path components
7171
image_parts = split("/", var.image)
72-
72+
7373
# Extract repo (first part) and path (remaining parts)
7474
parsed_repo = var.repo != "" ? var.repo : local.image_parts[0]
7575
parsed_path = var.repo_path != "" ? var.repo_path : "/${join("/", slice(local.image_parts, 1, length(local.image_parts)))}"
@@ -89,40 +89,40 @@ locals {
8989
medium = 0
9090
low = 0
9191
}
92-
92+
9393
total_vulnerabilities = local.vulnerabilities.critical + local.vulnerabilities.high + local.vulnerabilities.medium + local.vulnerabilities.low
9494
}
9595

9696
# Create metadata resource to display vulnerability information
9797
resource "coder_metadata" "xray_vulnerabilities" {
9898
count = data.coder_workspace.me.start_count
9999
resource_id = var.resource_id
100-
100+
101101
item {
102102
key = "Image"
103103
value = var.image
104104
}
105-
105+
106106
item {
107107
key = "Total Vulnerabilities"
108108
value = tostring(local.total_vulnerabilities)
109109
}
110-
110+
111111
item {
112112
key = "Critical"
113113
value = tostring(local.vulnerabilities.critical)
114114
}
115-
115+
116116
item {
117117
key = "High"
118118
value = tostring(local.vulnerabilities.high)
119119
}
120-
120+
121121
item {
122122
key = "Medium"
123123
value = tostring(local.vulnerabilities.medium)
124124
}
125-
125+
126126
item {
127127
key = "Low"
128128
value = tostring(local.vulnerabilities.low)

0 commit comments

Comments
 (0)