Skip to content

Commit 25bc14d

Browse files
committed
Merge branch 'main' into pooknull/main
* main: (34 commits) break: return error from Customize request option (testcontainers#2267) fix: wrong copy paste (testcontainers#2515) docs: add documentation for Exec method (testcontainers#2451) docs: document the SSHd tunnel (testcontainers#2514) fix: enhance host configuration port binding (testcontainers#2512) feat: forward host ports to a container using an SSH tunnel (testcontainers#2471) Update follow_logs.md with adding missing package (testcontainers#2513) fix: don't retry on permanent APIClient errors (testcontainers#2506) feat: support overriding the default recreate options for compose (testcontainers#2511) feat: support passing io.Reader for compose files when creating a compose instance (testcontainers#2509) chore: add funding button for testcontainers (testcontainers#2510) feat: support Ryuk for the compose module (testcontainers#2485) chore(deps): bump golang.org/x/net in modules (minio, gcloud, weaviate, compose, qdrant, couchbase, k3s, milvus, mockserver, pulsar, kafka) (testcontainers#2505) fix: fallback to URL-path when parsing auth config URL without scheme (testcontainers#2488) fix(postgres): Fix the non-default dbname error (testcontainers#2489) feat: Bump default postgres version (testcontainers#2481) support Dolt (testcontainers#2177) chore: create TLS certs in a consistent manner (testcontainers#2478) chore(deps): bump idna from 3.6 to 3.7 (testcontainers#2480) Elasticsearch disable CA retrieval when ssl is disabled (testcontainers#2475) ...
2 parents 46ffd77 + 14d6929 commit 25bc14d

File tree

230 files changed

+5482
-2195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+5482
-2195
lines changed

.github/FUNDING.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: [testcontainers]

.github/workflows/ci-test-go.yml

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050
continue-on-error: ${{ !inputs.fail-fast }}
5151
env:
5252
TESTCONTAINERS_RYUK_DISABLED: "${{ inputs.ryuk-disabled }}"
53+
RYUK_CONNECTION_TIMEOUT: "${{ inputs.project-directory == 'modules/compose' && '5m' || '60s' }}"
54+
RYUK_RECONNECTION_TIMEOUT: "${{ inputs.project-directory == 'modules/compose' && '30s' || '10s' }}"
5355
steps:
5456
- name: Setup rootless Docker
5557
if: ${{ inputs.rootless-docker }}

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
matrix:
9595
go-version: [1.21.x, 1.x]
9696
platform: [ubuntu-latest]
97-
module: [artemis, cassandra, chroma, clickhouse, cockroachdb, compose, consul, couchbase, elasticsearch, gcloud, inbucket, influxdb, k3s, k6, kafka, localstack, mariadb, milvus, minio, mockserver, mongodb, mssql, mysql, nats, neo4j, ollama, openfga, openldap, opensearch, postgres, pulsar, qdrant, rabbitmq, redis, redpanda, registry, surrealdb, vault, weaviate]
97+
module: [artemis, cassandra, chroma, clickhouse, cockroachdb, compose, consul, couchbase, dolt, elasticsearch, gcloud, inbucket, influxdb, k3s, k6, kafka, localstack, mariadb, milvus, minio, mockserver, mongodb, mssql, mysql, nats, neo4j, ollama, openfga, openldap, opensearch, postgres, pulsar, qdrant, rabbitmq, redis, redpanda, registry, surrealdb, vault, weaviate]
9898
uses: ./.github/workflows/ci-test-go.yml
9999
with:
100100
go-version: ${{ matrix.go-version }}

.github/workflows/codeql.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
# Initializes the CodeQL tools for scanning.
5555
- name: Initialize CodeQL
56-
uses: github/codeql-action/init@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0
56+
uses: github/codeql-action/init@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
5757
with:
5858
languages: ${{ matrix.language }}
5959
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -67,7 +67,7 @@ jobs:
6767
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
6868
# If this step fails, then you should remove it and run the build manually (see below)
6969
- name: Autobuild
70-
uses: github/codeql-action/autobuild@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0
70+
uses: github/codeql-action/autobuild@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
7171

7272
# ℹ️ Command-line programs to run using the OS shell.
7373
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -80,6 +80,6 @@ jobs:
8080
# ./location_of_script_within_repo/buildscript.sh
8181

8282
- name: Perform CodeQL Analysis
83-
uses: github/codeql-action/analyze@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0
83+
uses: github/codeql-action/analyze@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
8484
with:
8585
category: "/language:${{matrix.language}}"

.github/workflows/scorecards.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ jobs:
5151

5252
# required for Code scanning alerts
5353
- name: "Upload SARIF results to code scanning"
54-
uses: github/codeql-action/upload-sarif@1500a131381b66de0c52ac28abb13cd79f4b7ecc # v2.22.12
54+
uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
5555
with:
5656
sarif_file: results.sarif

.golangci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ linters:
77
- misspell
88
- nonamedreturns
99
- testifylint
10+
- errcheck
1011

1112
linters-settings:
1213
errorlint:

.vscode/.testcontainers-go.code-workspace

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
"name": "module / couchbase",
4646
"path": "../modules/couchbase"
4747
},
48+
{
49+
"name": "module / dolt",
50+
"path": "../modules/dolt"
51+
},
4852
{
4953
"name": "module / elasticsearch",
5054
"path": "../modules/elasticsearch"

Pipfile.lock

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

container.go

+17-6
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ func (c *ContainerFile) validate() error {
121121
// ContainerRequest represents the parameters used to get a running container
122122
type ContainerRequest struct {
123123
FromDockerfile
124+
HostAccessPorts []int
124125
Image string
125126
ImageSubstitutors []ImageSubstitutor
126127
Entrypoint []string
@@ -221,13 +222,17 @@ func (c *ContainerRequest) GetContext() (io.Reader, error) {
221222
}
222223
c.Context = abs
223224

224-
excluded, err := parseDockerIgnore(abs)
225+
dockerIgnoreExists, excluded, err := parseDockerIgnore(abs)
225226
if err != nil {
226227
return nil, err
227228
}
228229

229-
dockerIgnoreLocation := filepath.Join(abs, ".dockerignore")
230-
includes = append(includes, dockerIgnoreLocation, c.GetDockerfile())
230+
if dockerIgnoreExists {
231+
// only add .dockerignore if it exists
232+
includes = append(includes, ".dockerignore")
233+
}
234+
235+
includes = append(includes, c.GetDockerfile())
231236

232237
buildContext, err := archive.TarWithOptions(
233238
c.Context,
@@ -240,18 +245,24 @@ func (c *ContainerRequest) GetContext() (io.Reader, error) {
240245
return buildContext, nil
241246
}
242247

243-
func parseDockerIgnore(targetDir string) ([]string, error) {
248+
// parseDockerIgnore returns if the file exists, the excluded files and an error if any
249+
func parseDockerIgnore(targetDir string) (bool, []string, error) {
244250
// based on https://github.com/docker/cli/blob/master/cli/command/image/build/dockerignore.go#L14
245251
fileLocation := filepath.Join(targetDir, ".dockerignore")
246252
var excluded []string
253+
exists := false
247254
if f, openErr := os.Open(fileLocation); openErr == nil {
255+
defer f.Close()
256+
257+
exists = true
258+
248259
var err error
249260
excluded, err = ignorefile.ReadAll(f)
250261
if err != nil {
251-
return excluded, fmt.Errorf("error reading .dockerignore: %w", err)
262+
return true, excluded, fmt.Errorf("error reading .dockerignore: %w", err)
252263
}
253264
}
254-
return excluded, nil
265+
return exists, excluded, nil
255266
}
256267

257268
// GetBuildArgs returns the env args to be used when creating from Dockerfile

container_ignore_test.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,32 @@ import (
1111
func TestParseDockerIgnore(t *testing.T) {
1212
testCases := []struct {
1313
filePath string
14+
exists bool
1415
expectedErr error
1516
expectedExcluded []string
1617
}{
1718
{
1819
filePath: "./testdata/dockerignore",
1920
expectedErr: nil,
21+
exists: true,
2022
expectedExcluded: []string{"vendor", "foo", "bar"},
2123
},
2224
{
2325
filePath: "./testdata",
2426
expectedErr: nil,
27+
exists: true,
2528
expectedExcluded: []string{"Dockerfile", "echo.Dockerfile"},
2629
},
30+
{
31+
filePath: "./testdata/data",
32+
expectedErr: nil,
33+
expectedExcluded: nil, // it's nil because the parseDockerIgnore function uses the zero value of a slice
34+
},
2735
}
2836

2937
for _, testCase := range testCases {
30-
excluded, err := parseDockerIgnore(testCase.filePath)
38+
exists, excluded, err := parseDockerIgnore(testCase.filePath)
39+
assert.Equal(t, testCase.exists, exists)
3140
assert.Equal(t, testCase.expectedErr, err)
3241
assert.Equal(t, testCase.expectedExcluded, excluded)
3342
}

0 commit comments

Comments
 (0)