sourcearchive

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package sourcearchive 는 외부 원본 저장소의 특정 커밋 파일을 가져온다.

템플릿이 원본을 새 앱 저장소로 복사할 때 쓴다(port.SourceArchive). git 을 실행하지 않고 호스트가 내주는 커밋 아카이브를 받아 푼다 — API 파드에는 git 이 없고, 이력은 필요 없다.

Index

Constants

This section is empty.

Variables

View Source
var DefaultLimits = Limits{
	MaxFiles:      1000,
	MaxTotalBytes: 32 << 20,
	MaxFileBytes:  8 << 20,
}

DefaultLimits 는 eGov 샘플(파일 약 150개, 2.8MB)에 여유를 둔 값이다. 가져온 파일은 커밋 요청 하나에 실리고(GitLab 커밋 API 는 요청 하나, 바이너리는 base64 로 3분의 1 이 늘어난다) 그 요청은 타임아웃 안에 끝나야 한다.

Functions

This section is empty.

Types

type GitHub

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

GitHub 은 github.com 저장소의 커밋 아카이브를 받는다.

func NewGitHub

func NewGitHub(client *http.Client) *GitHub

NewGitHub 은 어댑터를 만든다. client 가 nil 이면 제한 시간을 둔 기본 클라이언트를 쓴다.

func (*GitHub) Fetch

func (g *GitHub) Fetch(ctx context.Context, repoURL, commit string) ([]port.CommitFile, error)

Fetch 는 저장소의 commit 시점 파일을 돌려준다.

func (*GitHub) Supports

func (g *GitHub) Supports(repoURL string) error

Supports 는 그 주소를 가져올 수 있는 모양인지 본다. 네트워크를 쓰지 않는다.

func (*GitHub) WithBaseURL

func (g *GitHub) WithBaseURL(baseURL string) *GitHub

WithBaseURL 은 아카이브를 받을 주소를 바꾼다(테스트·사설 미러).

func (*GitHub) WithLimits

func (g *GitHub) WithLimits(limits Limits) *GitHub

WithLimits 는 크기 한도를 바꾼다.

type Limits

type Limits struct {
	MaxFiles      int
	MaxTotalBytes int64
	MaxFileBytes  int64
}

Limits 는 가져올 수 있는 원본의 크기다.

가져온 파일은 SCM 커밋 API 요청 하나에 실린다. 너무 크면 SCM 이 요청을 거부하거나 API 메모리를 다 쓴다 — 템플릿은 출발점이라 큰 저장소를 옮기는 용도가 아니다.

Jump to

Keyboard shortcuts

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