diff --git a/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareCustomPackage/SoftwareCustomPackage.tsx b/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareCustomPackage/SoftwareCustomPackage.tsx
index 77174ef397..9a029405c3 100644
--- a/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareCustomPackage/SoftwareCustomPackage.tsx
+++ b/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareCustomPackage/SoftwareCustomPackage.tsx
@@ -17,6 +17,7 @@ import FileProgressModal from "components/FileProgressModal";
import PremiumFeatureMessage from "components/PremiumFeatureMessage";
import Spinner from "components/Spinner";
import DataError from "components/DataError";
+import InfoBanner from "components/InfoBanner";
import CategoriesEndUserExperienceModal from "pages/SoftwarePage/components/modals/CategoriesEndUserExperienceModal";
import PackageForm from "pages/SoftwarePage/components/forms/PackageForm";
@@ -170,6 +171,13 @@ const SoftwareCustomPackage = ({
return (
<>
+ {gitOpsModeEnabled && (
+
+ Add custom packages in GitOps mode so Fleet can host your software.
+ After adding, copy its SHA-256 hash into your YAML so the next
+ GitOps workflow doesn't delete it.
+
+ )}
{
- const { renderFlash } = useContext(NotificationContext);
const { config } = useContext(AppContext);
const repositoryUrl = config?.gitops?.repository_url;
const { name, version, url, hash_sha256: sha256 } = softwarePackage;
- // Script packages (.sh and .ps1) should not expose install_script,
- // post_install_script, uninstall_script, or pre_install_query fields
- const preInstallQuery = !isScriptPackage
- ? softwarePackage.pre_install_query
- : undefined;
- const installScript = !isScriptPackage
- ? softwarePackage.install_script
- : undefined;
- const postInstallScript = !isScriptPackage
- ? softwarePackage.post_install_script
- : undefined;
- const uninstallScript = !isScriptPackage
- ? softwarePackage.uninstall_script
- : undefined;
-
const packageYaml = createPackageYaml({
softwareTitle: softwareTitleName,
packageName: name,
version,
url,
sha256,
- preInstallQuery,
- installScript,
- postInstallScript,
- uninstallScript,
iconUrl: iconUrl || null,
displayName,
isScriptPackage,
});
- // Generic download handler
- const handleDownload = async ({
- evt,
- content,
- downloadUrl,
- filename,
- filetype,
- errorMsg,
- }: HandleDownloadParams) => {
- evt.preventDefault();
-
- try {
- if (content) {
- const file = new window.File([content], filename, { type: filetype });
- FileSaver.saveAs(file);
- } else if (downloadUrl) {
- const response = await fetch(downloadUrl);
- if (!response.ok) throw new Error(`HTTP ${response.status}`);
- const blob = await response.blob();
- FileSaver.saveAs(blob, filename);
- } else {
- throw new Error("No content or URL provided");
- }
- } catch (err) {
- renderFlash("error", errorMsg);
- }
- return false;
- };
-
const hyphenatedSoftwareTitle = hyphenateString(softwareTitleName);
- const onDownloadPreInstallQuery = (evt: React.MouseEvent) => {
- const softwareExtension = getExtensionFromFileName(name);
- const preInstallQueryContent = `- name: "[Pre-install software] ${softwareTitleName} (${softwareExtension})"\n query: ${preInstallQuery}`;
-
- handleDownload({
- evt,
- content: preInstallQueryContent,
- filename: `pre-install-query-${hyphenatedSoftwareTitle}.yml`,
- filetype: "text/yml",
- errorMsg:
- "Your pre-install query could not be downloaded. Please create YAML file (.yml) manually.",
- });
- };
-
- const onDownloadPostInstallScript = (evt: React.MouseEvent) => {
- handleDownload({
- evt,
- content: postInstallScript,
- filename: `post-install-${hyphenatedSoftwareTitle}.sh`,
- filetype: "text/sh",
- errorMsg:
- "Your post-install script could not be downloaded. Please create script file (.sh) manually.",
- });
- };
-
- const onDownloadInstallScript = (evt: React.MouseEvent) => {
- handleDownload({
- evt,
- content: installScript,
- filename: `install-${hyphenatedSoftwareTitle}.sh`,
- filetype: "text/sh",
- errorMsg:
- "Your install script could not be downloaded. Please create script file (.sh) manually.",
- });
- };
-
- const onDownloadUninstallScript = (evt: React.MouseEvent) => {
- handleDownload({
- evt,
- content: uninstallScript,
- filename: `uninstall-${hyphenatedSoftwareTitle}.sh`,
- filetype: "text/sh",
- errorMsg:
- "Your uninstall script could not be downloaded. Please create script file (.sh) manually.",
- });
- };
-
- const onDownloadIcon = async (evt: React.MouseEvent) => {
- evt.preventDefault();
-
- try {
- // Get icon blob + create filename
- const response = await softwareAPI.getSoftwareIcon(softwareId, teamId);
- // Different from icon's original filename as we are suggesting a standard name used in YAML
- const filename = `${hyphenatedSoftwareTitle}-icon.png`;
-
- // Save the file
- FileSaver.saveAs(response.data, filename);
- } catch (err) {
- renderFlash(
- "error",
- "Your icon could not be downloaded. Please download the image manually."
- );
- }
- };
-
return (
<>
-
-
- To complete your GitOps configuration, follow the instructions
- below. If the YAML is not added, new installers will be deleted on
- the next GitOps run, and edited installers will cause the GitOps run
- to fail.
-
-
-
{repositoryUrl && (
- First, create the YAML file below and save it to your{" "}
- .
+ Manage in .
)}
-
Make sure you reference the package YAML from your fleet YAML.
-
+
+ If you added advanced options, learn how to{" "}
+
+ .
+ >
+ }
+ />