From aaa8a0ab141aa08082abb1a4e982919145c1dac6 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Wed, 5 Mar 2025 23:36:55 +0000 Subject: [PATCH 1/6] dependabot - groups Signed-off-by: Mathieu Benoit --- .github/dependabot.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0cfc43c..429ca2d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,7 +4,15 @@ updates: directory: "/" schedule: interval: "weekly" + groups: + ci: + patterns: + - "*" - package-ecosystem: "gomod" directory: "/" schedule: interval: "weekly" + groups: + ci: + patterns: + - "*" From 918ef1a9afdc1fd8aad9727c21f26df2460a8449 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Wed, 5 Mar 2025 23:39:45 +0000 Subject: [PATCH 2/6] go 1.24.1 Signed-off-by: Mathieu Benoit --- go.mod | 4 ++-- go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 289b3c5..c811738 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/score-spec/score-implementation-sample -go 1.23.4 +go 1.24.1 require ( github.com/imdario/mergo v1.0.1 - github.com/score-spec/score-go v1.8.5 + github.com/score-spec/score-go v1.9.3 github.com/spf13/cobra v1.9.1 github.com/spf13/pflag v1.0.6 github.com/stretchr/testify v1.10.0 diff --git a/go.sum b/go.sum index 2175a1c..bcf18ae 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,8 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4= github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= -github.com/score-spec/score-go v1.8.5 h1:ssCvGojcM+cs+GK7/GuE2oA5iDoCqcAofL/Usce4UFI= -github.com/score-spec/score-go v1.8.5/go.mod h1:rW7jKWPPqubDzHmIlE/r/x5z64Q4eMdjKCxZ8XB+/LM= +github.com/score-spec/score-go v1.9.3 h1:YZ1M5MCn/FI6nQNI0RUC0l8tgSwceOg+P7YvvNUyaNE= +github.com/score-spec/score-go v1.9.3/go.mod h1:FTajUIhA1MyQeYtuTwVVisf+oqf+tV0V44g54hnnpMo= github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= From 1c3209419e75688f89734747f994da10e33aeb80 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Wed, 5 Mar 2025 23:43:58 +0000 Subject: [PATCH 3/6] fix: remove mergo replace directive Signed-off-by: Mathieu Benoit --- go.mod | 5 +---- go.sum | 2 -- internal/command/generate.go | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index c811738..12aaad0 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/score-spec/score-implementation-sample go 1.24.1 require ( - github.com/imdario/mergo v1.0.1 + dario.cat/mergo v1.0.1 github.com/score-spec/score-go v1.9.3 github.com/spf13/cobra v1.9.1 github.com/spf13/pflag v1.0.6 @@ -12,7 +12,6 @@ require ( ) require ( - dario.cat/mergo v1.0.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/kr/pretty v0.3.1 // indirect @@ -22,5 +21,3 @@ require ( github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) - -replace github.com/imdario/mergo => dario.cat/mergo v1.0.0 diff --git a/go.sum b/go.sum index bcf18ae..9bc3d6a 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= diff --git a/internal/command/generate.go b/internal/command/generate.go index 8dfa5e6..8005ceb 100644 --- a/internal/command/generate.go +++ b/internal/command/generate.go @@ -22,7 +22,7 @@ import ( "slices" "strings" - "github.com/imdario/mergo" + "dario.cat/mergo" "github.com/score-spec/score-go/framework" scoreloader "github.com/score-spec/score-go/loader" scoreschema "github.com/score-spec/score-go/schema" From 63c91ee8f71c2260755fb8876df667f0b65e9298 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Wed, 5 Mar 2025 23:52:08 +0000 Subject: [PATCH 4/6] Add Dockerfile Signed-off-by: Mathieu Benoit --- Dockerfile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7ddb5f9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM golang:1.24.1-alpine@sha256:43c094ad24b6ac0546c62193baeb3e6e49ce14d3250845d166c77c25f64b0386 AS builder + +# Set the current working directory inside the container. +WORKDIR /go/src/github.com/score-spec/score-implementation-sample + +# Copy just the module bits +COPY go.mod go.sum ./ +RUN go mod download + +# Copy the entire project and build it. +COPY . . +RUN CGO_ENABLED=0 GOOS=linux go build -o /usr/local/bin/score-implementation-sample ./cmd/score-implementation-sample + +# We can use gcr.io/distroless/static since we don't rely on any linux libs or state, but we need ca-certificates to connect to https/oci with the init command. +FROM gcr.io/distroless/static:530158861eebdbbf149f7e7e67bfe45eb433a35c@sha256:5c7e2b465ac6a2a4e5f4f7f722ce43b147dabe87cb21ac6c4007ae5178a1fa58 + +# Set the current working directory inside the container. +WORKDIR /score-implementation-sample + +# Copy the binary from the builder image. +COPY --from=builder /usr/local/bin/score-implementation-sample /usr/local/bin/score-implementation-sample + +# Run the binary. +ENTRYPOINT ["/usr/local/bin/score-implementation-sample"] \ No newline at end of file From 1eac80d45eea78cac4afe92cdf8844e9d9e7225b Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Thu, 6 Mar 2025 01:37:38 +0000 Subject: [PATCH 5/6] CI + Dependabot + dockerignore for Docker container Signed-off-by: Mathieu Benoit --- .dockerignore | 6 ++++++ .github/dependabot.yml | 8 ++++++++ .github/workflows/ci.yaml | 22 +++++++++++++++++++--- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7c8b6f7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +*/ +!go.mod +!go.sum +!.git/ +!cmd/ +!internal/ \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 429ca2d..9428c0f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -16,3 +16,11 @@ updates: ci: patterns: - "*" + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "weekly" + groups: + ci: + patterns: + - "*" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5722276..06eee9c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,20 +1,36 @@ name: CI on: push: + branches: + - main pull_request: jobs: test: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: setup-go - uses: actions/setup-go@v5 + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: go-version-file: go.mod - name: test run: go run gotest.tools/gotestsum@latest --format github-actions - name: lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0 with: version: latest + - name: Build docker image + uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 + with: + context: . + push: false + load: true + tags: score-implementation-sample:test + build-args: | + "VERSION=test" + - name: Test docker image + run: | + docker run --rm score-implementation-sample:test --version + docker run -v .:/score-implementation-sample --rm score-implementation-sample:test init + cat score.yaml From 60ec2dd7e245ba85e70f8e67277c4b18ee671ce2 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Thu, 6 Mar 2025 13:13:49 +0000 Subject: [PATCH 6/6] --help instead of --version for now Signed-off-by: Mathieu Benoit --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 06eee9c..0748672 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,6 +31,6 @@ jobs: "VERSION=test" - name: Test docker image run: | - docker run --rm score-implementation-sample:test --version + docker run --rm score-implementation-sample:test --help docker run -v .:/score-implementation-sample --rm score-implementation-sample:test init cat score.yaml