releasebundle

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package releasebundle provides temporary download and install endpoints for STX bundles. releasebundle 包提供 STX 离线发布包的临时下载与安装端点。

Package releasebundle provides temporary download and install endpoints for STX bundles. releasebundle 包提供 STX 离线发布包的临时下载与安装端点。

Index

Constants

View Source
const (
	// DefaultBundlePattern selects the CentOS 7 compatible STX release bundle.
	// DefaultBundlePattern 选择适用于 CentOS 7 的 STX 发布包。
	DefaultBundlePattern = "stx-*-linux-amd64-node18-glibc217-without-observability.tar.gz"
	// DefaultReleaseDir is the default directory containing built release tarballs.
	// DefaultReleaseDir 是默认的发布包输出目录。
	DefaultReleaseDir = "./dist/releases"
)

Variables

This section is empty.

Functions

func GenerateInstallScript

func GenerateInstallScript(data InstallScriptData) (string, error)

GenerateInstallScript renders the STX bundle install script. GenerateInstallScript 渲染 STX 离线包安装脚本。

Types

type ErrorResponse

type ErrorResponse struct {
	ErrorMsg string `json:"error_msg"`
}

ErrorResponse represents a simple JSON error payload. ErrorResponse 表示简单的 JSON 错误响应。

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler exposes temporary download/install endpoints for STX bundles. Handler 暴露 STX 离线包的临时下载安装端点。

func NewHandler

func NewHandler(cfg *HandlerConfig) *Handler

NewHandler creates a new release bundle handler. NewHandler 创建新的发布包处理器。

func (*Handler) DownloadBundle

func (h *Handler) DownloadBundle(c *gin.Context)

DownloadBundle handles GET /api/v1/stx/download and serves the latest matching bundle. DownloadBundle 处理 GET /api/v1/stx/download 并返回最新匹配的发布包。

func (*Handler) GetInstallScript

func (h *Handler) GetInstallScript(c *gin.Context)

GetInstallScript handles GET /api/v1/stx/install.sh and returns a one-click install script. GetInstallScript 处理 GET /api/v1/stx/install.sh 并返回一键安装脚本。

type HandlerConfig

type HandlerConfig struct {
	// ReleaseDir points to the directory containing built release tarballs.
	// ReleaseDir 指向发布包产物所在目录。
	ReleaseDir string
	// BundlePattern narrows the bundle selection to the desired package family.
	// BundlePattern 用于将可选发布包限制为目标包族。
	BundlePattern string
	// ValidateCredentials validates the provided username/password pair.
	// ValidateCredentials 校验提供的用户名和密码。
	ValidateCredentials func(ctx context.Context, username, password string) (bool, error)
}

HandlerConfig configures the release bundle handler. HandlerConfig 配置发布包处理器。

type InstallScriptData

type InstallScriptData struct {
	// DownloadURL points to the package download endpoint.
	// DownloadURL 指向发布包下载端点。
	DownloadURL string
	// ExampleCommand is shown when the script is not executed as root.
	// ExampleCommand 用于在非 root 执行时展示示例命令。
	ExampleCommand string
}

InstallScriptData holds the values injected into the release install script template. InstallScriptData 保存渲染发布包安装脚本模板所需的数据。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL