Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/components/common/ArtifactForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { Input } from "../ui/input";
import Callout from "./Callout";

import { validateArtifactNameAgainstPurlSpec } from "../../utils/common";
import { documentationLinks } from "@/const/documentationLinks";
import { Alert, AlertDescription } from "../ui/alert";

interface Props {
Expand All @@ -41,7 +42,11 @@ const ArtifactForm = ({ form, isEditMode = false }: Props) => {
<FormField
control={form.control}
name="artifactName"
rules={{ required: "Artifact name is required" }}
rules={{
required: "Artifact name is required",
validate: (value) =>
!value?.includes("@") || "You shall not enter a version/branch",
}}
render={({ field }) => (
<FormItem>
<FormLabel>Artifact Name</FormLabel>
Expand Down Expand Up @@ -76,6 +81,21 @@ const ArtifactForm = ({ form, isEditMode = false }: Props) => {
{"). Any Qualifiers can be added straight to the artifact name."}
</FormDescription>
<FormMessage />
{field.value?.includes("@") && (
<p className="mt-1 text-sm text-muted-foreground">
DevGuard automatically appends the branch or version (the ref)
to the artifact name, so adding it here yourself causes a
duplicated reference (e.g. <code>@main@main</code>).{" "}
<Link
target="_blank"
className="underline"
href={documentationLinks.artifactVersioning}
>
Learn why
</Link>
.
</p>
)}
</FormItem>
)}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/const/documentationLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export const documentationLinks = {
"https://devguard.org/explanations/compliance/csaf-vex-explained",
artifactExplaining:
"https://devguard.org/explanations/core-concepts/artifacts",
artifactVersioning:
"https://docs.devguard.org/how-to-guides/scanning/branches-tags-and-artifacts/",
acceptRisk:
"https://devguard.org/explanations/vulnerability-management/vulnerability-events#4-accept-risk",
riskCalculation:
Expand Down
Loading