mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
Merge branch 'master' into reprovide-sweep
This commit is contained in:
commit
138a86636a
@ -1,5 +1,7 @@
|
||||
# If we decide to run build-image.yml on every PR, we could deprecate this workflow.
|
||||
name: Docker Build
|
||||
# This workflow performs a quick Docker build check on PRs and pushes to master.
|
||||
# It builds the Docker image and runs a basic smoke test to ensure the image works.
|
||||
# This is a lightweight check - for full multi-platform builds and publishing, see docker-image.yml
|
||||
name: Docker Check
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@ -15,7 +17,20 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
docker-build:
|
||||
lint:
|
||||
if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: hadolint/hadolint-action@v3.1.0
|
||||
with:
|
||||
dockerfile: Dockerfile
|
||||
failure-threshold: warning
|
||||
verbose: true
|
||||
format: tty
|
||||
|
||||
build:
|
||||
if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
4
.github/workflows/docker-image.yml
vendored
4
.github/workflows/docker-image.yml
vendored
@ -1,3 +1,7 @@
|
||||
# This workflow builds and publishes official Docker images to Docker Hub.
|
||||
# It handles multi-platform builds (amd64, arm/v7, arm64/v8) and pushes tagged releases.
|
||||
# This workflow is triggered on tags, specific branches, and can be manually dispatched.
|
||||
# For quick build checks during development, see docker-check.yml
|
||||
name: Docker Push
|
||||
|
||||
on:
|
||||
|
||||
13
.hadolint.yaml
Normal file
13
.hadolint.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
# Hadolint configuration for Kubo Docker image
|
||||
# https://github.com/hadolint/hadolint
|
||||
|
||||
# Ignore specific rules
|
||||
ignored:
|
||||
# DL3008: Pin versions in apt-get install
|
||||
# We use stable base images and prefer smaller layers over version pinning
|
||||
- DL3008
|
||||
|
||||
# Trust base images from these registries
|
||||
trustedRegistries:
|
||||
- docker.io
|
||||
- gcr.io
|
||||
@ -8,9 +8,9 @@ ENV SRC_DIR=/kubo
|
||||
|
||||
# Cache go module downloads between builds for faster rebuilds
|
||||
COPY go.mod go.sum $SRC_DIR/
|
||||
WORKDIR $SRC_DIR
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
cd $SRC_DIR \
|
||||
&& go mod download
|
||||
go mod download
|
||||
|
||||
COPY . $SRC_DIR
|
||||
|
||||
@ -25,8 +25,7 @@ ARG MAKE_TARGET=build
|
||||
# mkdir .git/objects allows git rev-parse to read commit hash for version info
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
cd $SRC_DIR \
|
||||
&& mkdir -p .git/objects \
|
||||
mkdir -p .git/objects \
|
||||
&& GOOS=$TARGETOS GOARCH=$TARGETARCH GOFLAGS=-buildvcs=false make ${MAKE_TARGET} IPFS_PLUGINS=$IPFS_PLUGINS
|
||||
|
||||
# Extract required runtime tools from Debian.
|
||||
|
||||
@ -7,5 +7,5 @@ type Plugins struct {
|
||||
|
||||
type Plugin struct {
|
||||
Disabled bool
|
||||
Config interface{}
|
||||
Config interface{} `json:",omitempty"`
|
||||
}
|
||||
|
||||
@ -245,6 +245,14 @@ func (n *Node) Init(ipfsArgs ...string) *Node {
|
||||
cfg.Swarm.DisableNatPortMap = true
|
||||
cfg.Discovery.MDNS.Enabled = n.EnableMDNS
|
||||
cfg.Routing.LoopbackAddressesOnLanDHT = config.True
|
||||
// Telemetry disabled by default in tests.
|
||||
cfg.Plugins = config.Plugins{
|
||||
Plugins: map[string]config.Plugin{
|
||||
"telemetry": config.Plugin{
|
||||
Disabled: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
return n
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ func TestTelemetry(t *testing.T) {
|
||||
|
||||
// Create a new node
|
||||
node := harness.NewT(t).NewNode().Init()
|
||||
node.SetIPFSConfig("Plugins.Plugins.telemetry.Disabled", false)
|
||||
|
||||
// Set the opt-out environment variable
|
||||
node.Runner.Env["IPFS_TELEMETRY"] = "off"
|
||||
@ -64,6 +65,7 @@ func TestTelemetry(t *testing.T) {
|
||||
|
||||
// Create a new node
|
||||
node := harness.NewT(t).NewNode().Init()
|
||||
node.SetIPFSConfig("Plugins.Plugins.telemetry.Disabled", false)
|
||||
|
||||
// Set opt-out via config
|
||||
node.IPFS("config", "Plugins.Plugins.telemetry.Config.Mode", "off")
|
||||
@ -106,6 +108,7 @@ func TestTelemetry(t *testing.T) {
|
||||
|
||||
// Create a new node
|
||||
node := harness.NewT(t).NewNode().Init()
|
||||
node.SetIPFSConfig("Plugins.Plugins.telemetry.Disabled", false)
|
||||
|
||||
// Create a UUID file manually to simulate previous telemetry run
|
||||
uuidPath := filepath.Join(node.Dir, "telemetry_uuid")
|
||||
@ -154,6 +157,7 @@ func TestTelemetry(t *testing.T) {
|
||||
|
||||
// Create a new node
|
||||
node := harness.NewT(t).NewNode().Init()
|
||||
node.SetIPFSConfig("Plugins.Plugins.telemetry.Disabled", false)
|
||||
|
||||
// Capture daemon output
|
||||
stdout := &harness.Buffer{}
|
||||
@ -255,6 +259,7 @@ func TestTelemetry(t *testing.T) {
|
||||
|
||||
// Create a new node
|
||||
node := harness.NewT(t).NewNode().Init()
|
||||
node.SetIPFSConfig("Plugins.Plugins.telemetry.Disabled", false)
|
||||
|
||||
// Configure telemetry with a very short delay for testing
|
||||
node.IPFS("config", "Plugins.Plugins.telemetry.Config.Delay", "100ms")
|
||||
|
||||
@ -205,6 +205,10 @@ test_init_ipfs() {
|
||||
ipfs init "${args[@]}" --profile=test > /dev/null
|
||||
'
|
||||
|
||||
test_expect_success "disable telemetry" '
|
||||
test_config_set --bool Plugins.Plugins.telemetry.Disabled "true"
|
||||
'
|
||||
|
||||
test_expect_success "prepare config -- mounting" '
|
||||
mkdir mountdir ipfs ipns mfs &&
|
||||
test_config_set Mounts.IPFS "$(pwd)/ipfs" &&
|
||||
@ -227,6 +231,10 @@ test_init_ipfs_measure() {
|
||||
ipfs init "${args[@]}" --profile=test,flatfs-measure > /dev/null
|
||||
'
|
||||
|
||||
test_expect_success "disable telemetry" '
|
||||
test_config_set --bool Plugins.Plugins.telemetry.Disabled "true"
|
||||
'
|
||||
|
||||
test_expect_success "prepare config -- mounting" '
|
||||
mkdir mountdir ipfs ipns &&
|
||||
test_config_set Mounts.IPFS "$(pwd)/ipfs" &&
|
||||
|
||||
Loading…
Reference in New Issue
Block a user