Compare commits
27 Commits
0.1.5
...
0.2.0+scou
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb0a187c6f | ||
|
|
acee7d2996 | ||
|
|
64e8ebd9aa | ||
|
|
4c3e1a916d | ||
|
|
d8f02e88a8 | ||
|
|
ea6437da47 | ||
|
|
58a00c1c28 | ||
|
|
db72a473db | ||
|
|
788e58e2d9 | ||
|
|
f5ba5c5c5e | ||
|
|
57d845359d | ||
|
|
c6d52b5a12 | ||
|
|
1595c5de2c | ||
|
|
b047c9d317 | ||
|
|
797749d161 | ||
|
|
b158093722 | ||
|
|
ea27d25734 | ||
|
|
1871153199 | ||
|
|
69ad587e88 | ||
|
|
68f1952059 | ||
|
|
b70293a17f | ||
|
|
5e8e38fb72 | ||
|
|
711ff81119 | ||
|
|
fc9040027d | ||
|
|
d8c86b4c99 | ||
|
|
dd29e41dd1 | ||
|
|
b8d4b18bd6 |
@@ -1 +1,32 @@
|
||||
pod-atomisthq-tools.docker
|
||||
# Include any files or directories that you don't want to be copied to your
|
||||
# container here (e.g., local build artifacts, temporary files, etc.).
|
||||
#
|
||||
# For more help, visit the .dockerignore file reference guide at
|
||||
# https://docs.docker.com/engine/reference/builder/#dockerignore-file
|
||||
|
||||
**/.DS_Store
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
|
||||
9
.github/workflows/docker.yml
vendored
9
.github/workflows/docker.yml
vendored
@@ -1,6 +1,9 @@
|
||||
name: Build and push
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
@@ -28,8 +31,8 @@ jobs:
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
|
||||
with:
|
||||
username: dockerbuildbot
|
||||
password: ${{ secrets.DOCKERBUILDBOT_WRITE_PAT }}
|
||||
username: ${{ secrets.HUB_USER }}
|
||||
password: ${{ secrets.HUB_PAT }}
|
||||
|
||||
# Extract metadata (tags, labels) for Docker
|
||||
# https://github.com/docker/metadata-action
|
||||
@@ -55,3 +58,5 @@ jobs:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
secrets: |
|
||||
"gitghatoken=${{ secrets.GHA_REPO_TOKEN }}"
|
||||
|
||||
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -2,8 +2,8 @@ name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
jobs:
|
||||
releases-matrix:
|
||||
@@ -21,11 +21,11 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: wangyoucao577/go-release-action@v1.35
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
github_token: ${{ secrets.GHA_REPO_TOKEN }}
|
||||
goos: ${{ matrix.goos }}
|
||||
goarch: ${{ matrix.goarch }}
|
||||
goversion: 1.19.1
|
||||
binary_name: "babashka-pod-docker"
|
||||
release_tag: "0.1.0"
|
||||
release_tag: "0.2.0"
|
||||
overwrite: TRUE
|
||||
compress_assets: OFF
|
||||
|
||||
14
Dockerfile
14
Dockerfile
@@ -1,11 +1,17 @@
|
||||
FROM golang:1.19-alpine AS build
|
||||
FROM golang:1.21-alpine AS build
|
||||
|
||||
RUN apk --no-cache add git openssh-client
|
||||
|
||||
ENV GOPRIVATE=github.com/docker
|
||||
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||
RUN --mount=type=secret,id=gitghatoken ( git config --global url."https://x-access-token:$(cat /run/secrets/gitghatoken)@github.com/docker".insteadOf "https://github.com/docker")
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod ./
|
||||
COPY go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
RUN GOPRIVATE=github.com/docker go mod download
|
||||
|
||||
COPY main.go ./
|
||||
COPY docker/ ./docker/
|
||||
@@ -16,5 +22,5 @@ RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o babashka-pod-docker
|
||||
FROM alpine:3.17
|
||||
ARG version
|
||||
COPY repository/ /root/.babashka/pods/repository
|
||||
COPY --from=build /app/babashka-pod-docker /root/.babashka/pods/repository/docker/babashka-pod-docker/0.1.0
|
||||
RUN chmod 755 /root/.babashka/pods/repository/docker/babashka-pod-docker/0.1.0/babashka-pod-docker
|
||||
COPY --from=build /app/babashka-pod-docker /root/.babashka/pods/repository/docker/docker-tools/0.1.0
|
||||
RUN chmod 755 /root/.babashka/pods/repository/docker/docker-tools/0.1.0/babashka-pod-docker
|
||||
|
||||
72
Dockerfile.init
Normal file
72
Dockerfile.init
Normal file
@@ -0,0 +1,72 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Comments are provided throughout this file to help you get started.
|
||||
# If you need more help, visit the Dockerfile reference guide at
|
||||
# https://docs.docker.com/engine/reference/builder/
|
||||
|
||||
################################################################################
|
||||
# Create a stage for building the application.
|
||||
ARG GO_VERSION=1.19
|
||||
FROM golang:${GO_VERSION} AS build
|
||||
WORKDIR /src
|
||||
|
||||
# Download dependencies as a separate step to take advantage of Docker's caching.
|
||||
# Leverage a cache mount to /go/pkg/mod/ to speed up subsequent builds.
|
||||
# Leverage bind mounts to go.sum and go.mod to avoid having to copy them into
|
||||
# the container.
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=bind,source=go.sum,target=go.sum \
|
||||
--mount=type=bind,source=go.mod,target=go.mod \
|
||||
go mod download -x
|
||||
|
||||
# Build the application.
|
||||
# Leverage a cache mount to /go/pkg/mod/ to speed up subsequent builds.
|
||||
# Leverage a bind mount to the current directory to avoid having to copy the
|
||||
# source code into the container.
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=bind,target=. \
|
||||
CGO_ENABLED=0 go build -o /bin/server .
|
||||
|
||||
################################################################################
|
||||
# Create a new stage for running the application that contains the minimal
|
||||
# runtime dependencies for the application. This often uses a different base
|
||||
# image from the build stage where the necessary files are copied from the build
|
||||
# stage.
|
||||
#
|
||||
# The example below uses the alpine image as the foundation for running the app.
|
||||
# By specifying the "latest" tag, it will also use whatever happens to be the
|
||||
# most recent version of that image when you build your Dockerfile. If
|
||||
# reproducability is important, consider using a versioned tag
|
||||
# (e.g., alpine:3.17.2) or SHA (e.g., alpine:sha256:c41ab5c992deb4fe7e5da09f67a8804a46bd0592bfdf0b1847dde0e0889d2bff).
|
||||
FROM alpine:latest AS final
|
||||
|
||||
# Install any runtime dependencies that are needed to run your application.
|
||||
# Leverage a cache mount to /var/cache/apk/ to speed up subsequent builds.
|
||||
RUN --mount=type=cache,target=/var/cache/apk \
|
||||
apk --update add \
|
||||
ca-certificates \
|
||||
tzdata \
|
||||
&& \
|
||||
update-ca-certificates
|
||||
|
||||
# Create a non-privileged user that the app will run under.
|
||||
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
|
||||
ARG UID=10001
|
||||
RUN adduser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "/nonexistent" \
|
||||
--shell "/sbin/nologin" \
|
||||
--no-create-home \
|
||||
--uid "${UID}" \
|
||||
appuser
|
||||
USER appuser
|
||||
|
||||
# Copy the executable from the "build" stage.
|
||||
COPY --from=build /bin/server /bin/
|
||||
|
||||
# Expose the port that the application listens on.
|
||||
EXPOSE 3000
|
||||
|
||||
# What the container should run when it is started.
|
||||
ENTRYPOINT [ "/bin/server" ]
|
||||
28
Dockerfile.nix
Normal file
28
Dockerfile.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
# syntax = docker/dockerfile:1.4
|
||||
FROM nixos/nix:latest AS builder
|
||||
|
||||
WORKDIR /tmp/build
|
||||
RUN mkdir /tmp/nix-store-closure
|
||||
|
||||
RUN \
|
||||
--mount=type=cache,target=/nix,from=nixos/nix:latest,source=/nix \
|
||||
--mount=type=cache,target=/root/.cache \
|
||||
--mount=type=bind,target=/tmp/build \
|
||||
<<EOF
|
||||
nix \
|
||||
--extra-experimental-features "nix-command flakes" \
|
||||
--extra-substituters "http://host.docker.internal?priority=10" \
|
||||
--option filter-syscalls false \
|
||||
--show-trace \
|
||||
--log-format raw \
|
||||
build . --out-link /tmp/output/result
|
||||
cp -R $(nix-store -qR /tmp/output/result) /tmp/nix-store-closure
|
||||
EOF
|
||||
|
||||
FROM scratch
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /tmp/nix-store-closure /nix/store
|
||||
COPY --from=builder /tmp/output/ /app/
|
||||
ENTRYPOINT ["/app/result/bin/entrypoint"]
|
||||
16
dev/user.clj
16
dev/user.clj
@@ -24,9 +24,11 @@
|
||||
|
||||
(comment
|
||||
(pods/load-pod 'docker.tools "0.1.0")
|
||||
(pods/load-pod "result/bin/babashka-pod-docker")
|
||||
|
||||
(require '[docker.tools :as docker])
|
||||
|
||||
(pods/unload-pod {:pod/id "docker.tools"})
|
||||
|
||||
;; parse image names using github.com/docker/distribution
|
||||
;; turns golang structs into clojure maps
|
||||
@@ -39,18 +41,17 @@
|
||||
;; invalid reference format
|
||||
(println (.getMessage e))))
|
||||
|
||||
|
||||
;; parse dockerfiles using github.com/moby/buildkit
|
||||
;; returns the Result struct transformed to a clojure map
|
||||
(docker/parse-dockerfile "FROM \\\n gcr.io/whatever:tag\nCMD [\"run\"]")
|
||||
|
||||
|
||||
;; run sbom generation on local image
|
||||
(docker/sbom "vonwig/clojure-base:jdk17" (fn [event] (println event)))
|
||||
(docker/sbom "mongo@sha256:9c8a0a019671ed7d402768d4df6dddcc898828e21e9f7b90a34b55fe8ca676ac"
|
||||
(fn [event]
|
||||
(println "event " event)))
|
||||
|
||||
|
||||
(docker/hashes "vonwig/malware1:latest" (fn [event] (println event)))
|
||||
)
|
||||
(docker/hashes "vonwig/malware1:latest"
|
||||
(fn [event] (println event))))
|
||||
|
||||
(defn generate-sbom
|
||||
[image]
|
||||
@@ -69,5 +70,4 @@
|
||||
"docker.tools/generate-sbom"
|
||||
["ubuntu:latest" "" ""]
|
||||
{})
|
||||
(generate-sbom "alpine")
|
||||
)
|
||||
(generate-sbom "alpine"))
|
||||
|
||||
101
docker/ops.go
101
docker/ops.go
@@ -1,8 +1,11 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/docker/index-cli-plugin/lsp"
|
||||
"github.com/docker/scout-cli-plugin/push"
|
||||
"github.com/kballard/go-shellquote"
|
||||
"github.com/moby/buildkit/frontend/dockerfile/parser"
|
||||
|
||||
//"reflect"
|
||||
@@ -53,55 +56,11 @@ func parse_uri(s string) (Reference, error) {
|
||||
return Reference{Path: path, Domain: domain, Tag: tag, Digest: digest}, err
|
||||
}
|
||||
|
||||
func generate_sbom(message *babashka.Message, image string, username string, password string) error {
|
||||
tx_channel := make(chan string)
|
||||
func scout_push(message *babashka.Message, image string, organization string, authToken string, username string, password string) error {
|
||||
os.Setenv("DOCKER_SCOUT_REGISTRY_USER", username)
|
||||
os.Setenv("DOCKER_SCOUT_REGISTRY_PASSWORD", password)
|
||||
|
||||
go func() error {
|
||||
for {
|
||||
tx, ok := <-tx_channel
|
||||
if (ok && tx != "") {
|
||||
err := babashka.WriteNotDoneInvokeResponse(message, tx)
|
||||
if err != nil {
|
||||
babashka.WriteErrorResponse(message, err)
|
||||
}
|
||||
} else {
|
||||
tx_channel = nil
|
||||
break
|
||||
}
|
||||
}
|
||||
babashka.WriteInvokeResponse(message, "done");
|
||||
return nil
|
||||
}()
|
||||
|
||||
l := lsp.New()
|
||||
|
||||
if username != "" && password != "" {
|
||||
l.WithAuth(username, password)
|
||||
}
|
||||
|
||||
return l.Send(image, tx_channel)
|
||||
}
|
||||
|
||||
func generate_hashes(message *babashka.Message, s string) error {
|
||||
tx_channel := make(chan string)
|
||||
|
||||
go func() error {
|
||||
for {
|
||||
tx := <-tx_channel
|
||||
if tx != "" {
|
||||
err := babashka.WriteNotDoneInvokeResponse(message, tx)
|
||||
if err != nil {
|
||||
babashka.WriteErrorResponse(message, err)
|
||||
}
|
||||
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}()
|
||||
|
||||
return lsp.New().SendFileHashes(s, tx_channel)
|
||||
return push.Push(image, organization, authToken)
|
||||
}
|
||||
|
||||
func ProcessMessage(message *babashka.Message) (any, error) {
|
||||
@@ -121,33 +80,18 @@ func ProcessMessage(message *babashka.Message) (any, error) {
|
||||
Name: "parse-dockerfile",
|
||||
},
|
||||
{
|
||||
Name: "sbom",
|
||||
Code: `
|
||||
(defn sbom
|
||||
([image cb]
|
||||
(sbom image cb {}))
|
||||
([image cb opts]
|
||||
(babashka.pods/invoke
|
||||
"docker.tools"
|
||||
'docker.tools/generate-sbom
|
||||
[image]
|
||||
{:handlers {:success (fn [event]
|
||||
(cb event))
|
||||
:error (fn [{:keys [:ex-message :ex-data]}]
|
||||
(binding [*out* *err*]
|
||||
(println "ERROR:" ex-message)))
|
||||
:done (fn [] (cb "done"))}})))`,
|
||||
Name: "parse-shellwords",
|
||||
},
|
||||
{
|
||||
Name: "hashes",
|
||||
Name: "scout-push",
|
||||
Code: `
|
||||
(defn hashes
|
||||
(defn scout-push
|
||||
([image cb]
|
||||
(hashes image cb {}))
|
||||
([image cb opts]
|
||||
(babashka.pods/invoke
|
||||
"docker.tools"
|
||||
'docker.tools/generate-hashes
|
||||
'docker.tools/scout-push
|
||||
[image]
|
||||
{:handlers {:success (fn [event]
|
||||
(cb event))
|
||||
@@ -176,32 +120,19 @@ func ProcessMessage(message *babashka.Message) (any, error) {
|
||||
}
|
||||
reader := strings.NewReader(args[0])
|
||||
return parser.Parse(reader)
|
||||
case "docker.tools/generate-sbom":
|
||||
case "docker.tools/parse-shellwords":
|
||||
args := []string{}
|
||||
|
||||
if err := json.Unmarshal([]byte(message.Args), &args); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(args) == 3 {
|
||||
err := generate_sbom(message, args[0], args[1], args[2])
|
||||
if err != nil {
|
||||
babashka.WriteErrorResponse(message, err)
|
||||
}
|
||||
} else {
|
||||
err := generate_sbom(message, args[0], "", "")
|
||||
if err != nil {
|
||||
babashka.WriteErrorResponse(message, err)
|
||||
}
|
||||
}
|
||||
return "running", nil
|
||||
|
||||
case "docker.tools/generate-hashes":
|
||||
return shellquote.Split(args[0])
|
||||
case "docker.tools/scout-push":
|
||||
args := []string{}
|
||||
if err := json.Unmarshal([]byte(message.Args), &args); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err := generate_hashes(message, args[0])
|
||||
err := scout_push(message, args[0], args[1], args[2], args[3], args[4])
|
||||
if err != nil {
|
||||
babashka.WriteErrorResponse(message, err)
|
||||
}
|
||||
|
||||
133
flake.lock
generated
133
flake.lock
generated
@@ -2,19 +2,18 @@
|
||||
"nodes": {
|
||||
"devshell": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"platform-engineering",
|
||||
"nixpkgs"
|
||||
]
|
||||
],
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1678957337,
|
||||
"narHash": "sha256-Gw4nVbuKRdTwPngeOZQOzH/IFowmz4LryMPDiJN/ah4=",
|
||||
"lastModified": 1687173957,
|
||||
"narHash": "sha256-GOds2bAQcZ94fb9/Nl/aM+r+0wGSi4EKYuZYR8Dw4R8=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "3e0e60ab37cd0bf7ab59888f5c32499d851edb47",
|
||||
"rev": "2cf83bb31720fcc29a999aee28d6da101173e66a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -25,14 +24,14 @@
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"lastModified": 1687171271,
|
||||
"narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -41,9 +40,30 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"platform-engineering",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660459072,
|
||||
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gomod2nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
@@ -60,7 +80,38 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-filter": {
|
||||
"locked": {
|
||||
"lastModified": 1687178632,
|
||||
"narHash": "sha256-HS7YR5erss0JCaUijPeyg2XrisEb959FIct3n2TMGbE=",
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"rev": "d90c75e8319d0dd9be67d933d8eb9d0894ec9174",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1688392541,
|
||||
"narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "release-22.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1658285632,
|
||||
"narHash": "sha256-zRS5S/hoeDGUbO+L95wXG9vJNwsSYcl93XiD0HQBXLk=",
|
||||
@@ -76,28 +127,49 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1681762469,
|
||||
"narHash": "sha256-RYdEbufT7G+NKu/Gdz/XVCXprtzQid9eBKTQqBG1aM4=",
|
||||
"owner": "NixOS",
|
||||
"lastModified": 1686960236,
|
||||
"narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f25d4846d7a12a4d9d008aec86742d238b3b13c8",
|
||||
"rev": "04af42f3b31dba0ef742d254456dc4c14eedac86",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "release-22.11",
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"platform-engineering": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-utils": "flake-utils",
|
||||
"gitignore": "gitignore",
|
||||
"gomod2nix": "gomod2nix",
|
||||
"nix-filter": "nix-filter",
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1691541352,
|
||||
"narHash": "sha256-huAnvD9/udU6uZh3iEDLENA8duB0qaF1GQhPUcHHssA=",
|
||||
"owner": "slimslenderslacks",
|
||||
"repo": "nix-modules",
|
||||
"rev": "e7964c84c7e07c0c93143d70a9fca1de1d132992",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "slimslenderslacks",
|
||||
"repo": "nix-modules",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-utils": "flake-utils",
|
||||
"gomod2nix": "gomod2nix",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"platform-engineering": "platform-engineering"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
@@ -115,6 +187,21 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
|
||||
69
flake.nix
69
flake.nix
@@ -1,64 +1,23 @@
|
||||
{
|
||||
description = "Docker Pod";
|
||||
description = "Docker Pod v0.2.0-1";
|
||||
|
||||
inputs = {
|
||||
platform-engineering.url = "github:slimslenderslacks/nix-modules";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
gomod2nix.url = "github:nix-community/gomod2nix";
|
||||
devshell = {
|
||||
url = "github:numtide/devshell";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, gomod2nix, devshell }:
|
||||
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs
|
||||
{
|
||||
inherit system;
|
||||
overlays = [ gomod2nix.overlays.default devshell.overlays.default ];
|
||||
};
|
||||
in
|
||||
outputs = { nixpkgs, ... }@inputs:
|
||||
inputs.platform-engineering.golang-project
|
||||
{
|
||||
devShells.default = pkgs.devshell.mkShell {
|
||||
packages = with pkgs; [ go gotools golangci-lint gopls gopkgs go-outline gomod2nix.packages.${system}.default clojure clojure-lsp temurin-bin neovim];
|
||||
commands = [
|
||||
{
|
||||
name = "update-gomod2nix";
|
||||
help = "update gomod2nix.toml";
|
||||
command = "gomod2nix";
|
||||
}
|
||||
];
|
||||
};
|
||||
packages = rec {
|
||||
default = pkgs.buildGoApplication {
|
||||
pname = "babashka-pod-docker";
|
||||
version = "0.0.1";
|
||||
src = ./.;
|
||||
pwd = ./.;
|
||||
CGO_ENABLED = 0;
|
||||
modules = ./gomod2nix.toml;
|
||||
inherit nixpkgs;
|
||||
dir = ./.;
|
||||
name = "babashka-pod-docker";
|
||||
version = "0.2.0";
|
||||
package-overlay = pkgs: packages:
|
||||
packages // {
|
||||
default = pkgs.writeShellScriptBin "entrypoint" ''
|
||||
${packages.app}/bin/babashka-pod-docker
|
||||
'';
|
||||
};
|
||||
|
||||
docker = pkgs.dockerTools.buildImage {
|
||||
name = "docker-pod";
|
||||
tag = "latest";
|
||||
config = {
|
||||
Cmd = [ "${default}/bin/babashka-pod-docker" ];
|
||||
};
|
||||
};
|
||||
|
||||
default-linux = default.overrideAttrs (old: old // { GOOS = "linux"; GOARCH = "arm64"; });
|
||||
docker-arm64 = pkgs.dockerTools.buildImage {
|
||||
name = "docker-pod";
|
||||
tag = "latest";
|
||||
config = {
|
||||
Cmd = [ "${default-linux}/bin/linux_arm64/babashka-pod-docker" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
253
go.mod
253
go.mod
@@ -1,20 +1,24 @@
|
||||
module babashka-pod-docker
|
||||
|
||||
go 1.19
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/atomist-skills/go-skill v0.0.6-0.20221221214636-a7de163fd901
|
||||
github.com/docker/distribution v2.8.1+incompatible
|
||||
github.com/docker/index-cli-plugin v0.0.34-0.20230213201827-11b2a8c1eaa7
|
||||
github.com/docker/distribution v2.8.2+incompatible
|
||||
github.com/docker/scout-cli-plugin v0.22.4-0.20230821104039-f53ee5b6c67c
|
||||
github.com/jackpal/bencode-go v1.0.0
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||
github.com/moby/buildkit v0.11.4
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go/compute v1.10.0 // indirect
|
||||
cloud.google.com/go/compute v1.20.1 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.2.3 // indirect
|
||||
dario.cat/mergo v1.0.0 // indirect
|
||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 // indirect
|
||||
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20221215162035-5330a85ea652 // indirect
|
||||
github.com/Azure/azure-sdk-for-go v66.0.0+incompatible // indirect
|
||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
|
||||
github.com/Azure/go-autorest/autorest v0.11.28 // indirect
|
||||
github.com/Azure/go-autorest/autorest/adal v0.9.21 // indirect
|
||||
@@ -23,104 +27,108 @@ require (
|
||||
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
|
||||
github.com/Azure/go-autorest/logger v0.2.1 // indirect
|
||||
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
|
||||
github.com/CycloneDX/cyclonedx-go v0.6.0 // indirect
|
||||
github.com/CycloneDX/cyclonedx-go v0.7.1 // indirect
|
||||
github.com/DataDog/zstd v1.4.5 // indirect
|
||||
github.com/GoogleCloudPlatform/docker-credential-gcr v2.0.5+incompatible // indirect
|
||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||
github.com/Masterminds/semver/v3 v3.1.1 // indirect
|
||||
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
|
||||
github.com/Microsoft/go-winio v0.5.2 // indirect
|
||||
github.com/Microsoft/hcsshim v0.9.6 // indirect
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20220824120805-4b6e5c587895 // indirect
|
||||
github.com/Masterminds/semver v1.5.0 // indirect
|
||||
github.com/Masterminds/semver/v3 v3.2.0 // indirect
|
||||
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||
github.com/Microsoft/hcsshim v0.10.0-rc.7 // indirect
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
|
||||
github.com/acobaugh/osrelease v0.1.0 // indirect
|
||||
github.com/acomagu/bufpipe v1.0.3 // indirect
|
||||
github.com/anchore/go-logger v0.0.0-20220728155337-03b66a5207d8 // indirect
|
||||
github.com/acomagu/bufpipe v1.0.4 // indirect
|
||||
github.com/alecthomas/chroma v0.10.0 // indirect
|
||||
github.com/anchore/go-logger v0.0.0-20230531193951-db5ae83e7dbe // indirect
|
||||
github.com/anchore/go-macholibre v0.0.0-20220308212642-53e6d0aaf6fb // indirect
|
||||
github.com/anchore/packageurl-go v0.1.1-0.20220428202044-a072fa3cb6d7 // indirect
|
||||
github.com/anchore/stereoscope v0.0.0-20221006201143-d24c9d626b33 // indirect
|
||||
github.com/anchore/syft v0.62.1 // indirect
|
||||
github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 // indirect
|
||||
github.com/anchore/packageurl-go v0.1.1-0.20230104203445-02e0a6721501 // indirect
|
||||
github.com/anchore/stereoscope v0.0.0-20230727211946-d1f3d766295e // indirect
|
||||
github.com/anchore/syft v0.86.1 // indirect
|
||||
github.com/andybalholm/brotli v1.0.4 // indirect
|
||||
github.com/aquasecurity/go-dep-parser v0.0.0-20220626060741-179d0b167e5f // indirect
|
||||
github.com/aquasecurity/go-pep440-version v0.0.0-20210121094942-22b2f8951d46 // indirect
|
||||
github.com/aquasecurity/go-version v0.0.0-20210121072130-637058cfe492 // indirect
|
||||
github.com/aquasecurity/trivy v0.30.4 // indirect
|
||||
github.com/aquasecurity/trivy-db v0.0.0-20220627104749-930461748b63 // indirect
|
||||
github.com/aws/aws-sdk-go v1.44.46 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bmatcuk/doublestar/v4 v4.0.2 // indirect
|
||||
github.com/briandowns/spinner v1.12.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/cloudflare/circl v1.1.0 // indirect
|
||||
github.com/containerd/cgroups v1.0.4 // indirect
|
||||
github.com/containerd/containerd v1.6.18 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/aymerick/douceur v0.2.0 // indirect
|
||||
github.com/becheran/wildmatch-go v1.0.0 // indirect
|
||||
github.com/bmatcuk/doublestar/v4 v4.6.0 // indirect
|
||||
github.com/briandowns/spinner v1.23.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/charmbracelet/glamour v0.6.0 // indirect
|
||||
github.com/charmbracelet/lipgloss v0.7.1 // indirect
|
||||
github.com/cloudflare/circl v1.3.3 // indirect
|
||||
github.com/containerd/cgroups v1.1.0 // indirect
|
||||
github.com/containerd/containerd v1.7.0 // indirect
|
||||
github.com/containerd/continuity v0.3.0 // indirect
|
||||
github.com/containerd/fifo v1.0.0 // indirect
|
||||
github.com/containerd/stargz-snapshotter/estargz v0.13.0 // indirect
|
||||
github.com/containerd/ttrpc v1.1.1-0.20220420014843-944ef4a40df3 // indirect
|
||||
github.com/containerd/fifo v1.1.0 // indirect
|
||||
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
|
||||
github.com/containerd/ttrpc v1.2.1 // indirect
|
||||
github.com/containerd/typeurl v1.0.2 // indirect
|
||||
github.com/containerd/typeurl/v2 v2.1.0 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dgryski/go-minhash v0.0.0-20170608043002-7fe510aff544 // indirect
|
||||
github.com/deitch/magic v0.0.0-20230404182410-1ff89d7342da // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/dimchansky/utfbom v1.1.1 // indirect
|
||||
github.com/docker/cli v23.0.0-rc.1+incompatible // indirect
|
||||
github.com/docker/docker v23.0.0-rc.1+incompatible // indirect
|
||||
github.com/dlclark/regexp2 v1.4.0 // indirect
|
||||
github.com/docker/cli v24.0.5+incompatible // indirect
|
||||
github.com/docker/docker v24.0.5+incompatible // indirect
|
||||
github.com/docker/docker-credential-helpers v0.7.0 // indirect
|
||||
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
|
||||
github.com/docker/go-connections v0.4.0 // indirect
|
||||
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
|
||||
github.com/docker/go-metrics v0.0.1 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
|
||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
||||
github.com/ekzhu/minhash-lsh v0.0.0-20171225071031-5c06ee8586a1 // indirect
|
||||
github.com/emirpasic/gods v1.12.0 // indirect
|
||||
github.com/facebookincubator/nvdtools v0.1.4 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/edsrzf/mmap-go v1.1.0 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/facebookincubator/nvdtools v0.1.5 // indirect
|
||||
github.com/fatih/color v1.13.0 // indirect
|
||||
github.com/fvbommel/sortorder v1.0.2 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.0 // indirect
|
||||
github.com/go-enry/go-license-detector/v4 v4.3.0 // indirect
|
||||
github.com/go-git/gcfg v1.5.0 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.3.1 // indirect
|
||||
github.com/go-git/go-git/v5 v5.4.2 // indirect
|
||||
github.com/github/go-spdx/v2 v2.1.2 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.4.1 // indirect
|
||||
github.com/go-git/go-git/v5 v5.8.1 // indirect
|
||||
github.com/go-logr/logr v1.2.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-redis/redis/v8 v8.11.5 // indirect
|
||||
github.com/go-restruct/restruct v1.2.0-alpha // indirect
|
||||
github.com/gogo/googleapis v1.4.1 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/go-containerregistry v0.11.0 // indirect
|
||||
github.com/google/licenseclassifier/v2 v2.0.0-pre5 // indirect
|
||||
github.com/google/go-containerregistry v0.16.1 // indirect
|
||||
github.com/google/licensecheck v0.3.1 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/gookit/color v1.5.2 // indirect
|
||||
github.com/gorilla/mux v1.8.0 // indirect
|
||||
github.com/gorilla/css v1.0.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
|
||||
github.com/hasura/go-graphql-client v0.8.1 // indirect
|
||||
github.com/hhatto/gorst v0.0.0-20181029133204-ca9f730cac5b // indirect
|
||||
github.com/huandu/xstrings v1.3.2 // indirect
|
||||
github.com/imdario/mergo v0.3.13 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.1 // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/hasura/go-graphql-client v0.9.3 // indirect
|
||||
github.com/huandu/xstrings v1.3.3 // indirect
|
||||
github.com/imdario/mergo v0.3.15 // indirect
|
||||
github.com/in-toto/in-toto-golang v0.9.0 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jdkato/prose v1.1.0 // indirect
|
||||
github.com/jedib0t/go-pretty/v6 v6.4.0 // indirect
|
||||
github.com/jinzhu/copier v0.3.2 // indirect
|
||||
github.com/jinzhu/copier v0.3.5 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
|
||||
github.com/klauspost/compress v1.15.12 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/compress v1.16.5 // indirect
|
||||
github.com/klauspost/pgzip v1.2.5 // indirect
|
||||
github.com/knqyf263/go-rpmdb v0.0.0-20221030135625-4082a22221ce // indirect
|
||||
github.com/knqyf263/go-rpmdb v0.0.0-20230301153543-ba94b245509b // indirect
|
||||
github.com/knqyf263/nested v0.0.1 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.16 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.13 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/mattn/go-isatty v0.0.18 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||
github.com/mholt/archiver/v3 v3.5.1 // indirect
|
||||
github.com/microcosm-cc/bluemonday v1.0.21 // indirect
|
||||
github.com/microsoft/go-rustaudit v0.0.0-20220730194248-4b17361d90a5 // indirect
|
||||
github.com/miekg/pkcs11 v1.1.1 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
|
||||
@@ -130,89 +138,88 @@ require (
|
||||
github.com/moby/sys/mountinfo v0.6.2 // indirect
|
||||
github.com/moby/sys/sequential v0.5.0 // indirect
|
||||
github.com/moby/sys/signal v0.7.0 // indirect
|
||||
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
|
||||
github.com/montanaflynn/stats v0.0.0-20151014174947-eeaced052adb // indirect
|
||||
github.com/morikuni/aec v1.0.0 // indirect
|
||||
github.com/muesli/reflow v0.3.0 // indirect
|
||||
github.com/muesli/termenv v0.15.2 // indirect
|
||||
github.com/nwaples/rardecode v1.1.0 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/opencontainers/image-spec v1.0.3-0.20220303224323-02efb9a75ee1 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.0-rc4 // indirect
|
||||
github.com/opencontainers/runc v1.1.5 // indirect
|
||||
github.com/opencontainers/runtime-spec v1.0.3-0.20220311020903-6969a0a09ab1 // indirect
|
||||
github.com/opencontainers/selinux v1.10.2 // indirect
|
||||
github.com/opencontainers/runtime-spec v1.1.0-rc.1 // indirect
|
||||
github.com/opencontainers/selinux v1.11.0 // indirect
|
||||
github.com/openvex/go-vex v0.2.1 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.15 // indirect
|
||||
github.com/pjbgf/sha1cd v0.3.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/prometheus/client_golang v1.14.0 // indirect
|
||||
github.com/prometheus/client_model v0.3.0 // indirect
|
||||
github.com/prometheus/common v0.37.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/saferwall/pe v1.4.4 // indirect
|
||||
github.com/samber/lo v1.24.0 // indirect
|
||||
github.com/saracen/walker v0.0.0-20191201085201-324a081bae7e // indirect
|
||||
github.com/sassoftware/go-rpmutils v0.2.0 // indirect
|
||||
github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/shogo82148/go-shuffle v0.0.0-20170808115208-59829097ff3b // indirect
|
||||
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
|
||||
github.com/sergi/go-diff v1.3.1 // indirect
|
||||
github.com/shibumi/go-pathspec v1.3.0 // indirect
|
||||
github.com/shopspring/decimal v1.2.0 // indirect
|
||||
github.com/spdx/tools-golang v0.3.1-0.20230104082527-d6f58551be3f // indirect
|
||||
github.com/spf13/afero v1.8.2 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/spf13/cobra v1.6.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/stretchr/objx v0.4.0 // indirect
|
||||
github.com/stretchr/testify v1.8.0 // indirect
|
||||
github.com/sylabs/sif/v2 v2.8.1 // indirect
|
||||
github.com/skeema/knownhosts v1.2.0 // indirect
|
||||
github.com/spdx/tools-golang v0.5.3 // indirect
|
||||
github.com/spf13/afero v1.9.5 // indirect
|
||||
github.com/spf13/cast v1.5.1 // indirect
|
||||
github.com/stretchr/objx v0.5.0 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/sylabs/sif/v2 v2.11.5 // indirect
|
||||
github.com/sylabs/squashfs v0.6.1 // indirect
|
||||
github.com/therootcompany/xz v1.0.1 // indirect
|
||||
github.com/theupdateframework/notary v0.7.0 // indirect
|
||||
github.com/ulikunitz/xz v0.5.10 // indirect
|
||||
github.com/vbatts/go-mtree v0.5.0 // indirect
|
||||
github.com/vbatts/tar-split v0.11.2 // indirect
|
||||
github.com/vifraa/gopom v0.1.0 // indirect
|
||||
github.com/wagoodman/go-partybus v0.0.0-20210627031916-db1f5573bbc5 // indirect
|
||||
github.com/wagoodman/go-progress v0.0.0-20200731105512-1020f39e6240 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.0 // indirect
|
||||
github.com/vbatts/go-mtree v0.5.3 // indirect
|
||||
github.com/vbatts/tar-split v0.11.3 // indirect
|
||||
github.com/vifraa/gopom v0.2.2 // indirect
|
||||
github.com/wagoodman/go-partybus v0.0.0-20230516145632-8ccac152c651 // indirect
|
||||
github.com/wagoodman/go-progress v0.0.0-20230301185719-21920a456ad5 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
|
||||
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
|
||||
go.etcd.io/bbolt v1.3.6 // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
github.com/yuin/goldmark v1.5.2 // indirect
|
||||
github.com/yuin/goldmark-emoji v1.0.1 // indirect
|
||||
go.etcd.io/bbolt v1.3.7 // indirect
|
||||
go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/otel v1.14.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.14.0 // indirect
|
||||
go.uber.org/atomic v1.10.0 // indirect
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
go.uber.org/zap v1.23.0 // indirect
|
||||
golang.org/x/crypto v0.2.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20220823124025-807a23277127 // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/term v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/tools v0.1.12 // indirect
|
||||
golang.org/x/crypto v0.12.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230202163644-54bba9f4231b // indirect
|
||||
golang.org/x/mod v0.12.0 // indirect
|
||||
golang.org/x/net v0.14.0 // indirect
|
||||
golang.org/x/oauth2 v0.11.0 // indirect
|
||||
golang.org/x/sync v0.3.0 // indirect
|
||||
golang.org/x/sys v0.11.0 // indirect
|
||||
golang.org/x/term v0.11.0 // indirect
|
||||
golang.org/x/text v0.12.0 // indirect
|
||||
golang.org/x/tools v0.9.1 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||
gonum.org/v1/gonum v0.7.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e // indirect
|
||||
google.golang.org/grpc v1.50.1 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/neurosnap/sentences.v1 v1.0.6 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
|
||||
google.golang.org/grpc v1.55.0 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
lukechampine.com/uint128 v1.1.1 // indirect
|
||||
modernc.org/cc/v3 v3.36.0 // indirect
|
||||
modernc.org/ccgo/v3 v3.16.6 // indirect
|
||||
modernc.org/libc v1.16.7 // indirect
|
||||
modernc.org/mathutil v1.4.1 // indirect
|
||||
modernc.org/memory v1.1.1 // indirect
|
||||
modernc.org/opt v0.1.1 // indirect
|
||||
modernc.org/sqlite v1.17.3 // indirect
|
||||
modernc.org/strutil v1.1.1 // indirect
|
||||
modernc.org/token v1.0.0 // indirect
|
||||
k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5 // indirect
|
||||
lukechampine.com/uint128 v1.2.0 // indirect
|
||||
modernc.org/cc/v3 v3.40.0 // indirect
|
||||
modernc.org/ccgo/v3 v3.16.13 // indirect
|
||||
modernc.org/libc v1.24.1 // indirect
|
||||
modernc.org/mathutil v1.5.0 // indirect
|
||||
modernc.org/memory v1.6.0 // indirect
|
||||
modernc.org/opt v0.1.3 // indirect
|
||||
modernc.org/sqlite v1.25.0 // indirect
|
||||
modernc.org/strutil v1.1.3 // indirect
|
||||
modernc.org/token v1.0.1 // indirect
|
||||
nhooyr.io/websocket v1.8.7 // indirect
|
||||
olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 // indirect
|
||||
)
|
||||
|
||||
53
main.go
53
main.go
@@ -3,6 +3,8 @@ package main
|
||||
import (
|
||||
"babashka-pod-docker/babashka"
|
||||
"babashka-pod-docker/docker"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/atomist-skills/go-skill"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -10,27 +12,42 @@ import (
|
||||
|
||||
func main() {
|
||||
skill.Log.SetLevel(logrus.ErrorLevel)
|
||||
for {
|
||||
message, err := babashka.ReadMessage()
|
||||
if err != nil {
|
||||
babashka.WriteErrorResponse(message, err)
|
||||
continue
|
||||
}
|
||||
|
||||
res, err := docker.ProcessMessage(message)
|
||||
if err != nil {
|
||||
babashka.WriteErrorResponse(message, err)
|
||||
continue
|
||||
}
|
||||
args := os.Args
|
||||
|
||||
describeres, ok := res.(*babashka.DescribeResponse)
|
||||
if ok {
|
||||
babashka.WriteDescribeResponse(describeres)
|
||||
continue
|
||||
}
|
||||
if len(args) < 2 {
|
||||
args = append(os.Args, "pod")
|
||||
}
|
||||
|
||||
if res != "running" {
|
||||
babashka.WriteInvokeResponse(message, res)
|
||||
switch args[1] {
|
||||
|
||||
case "docker-cli-plugin-metadata":
|
||||
metadata := `{"SchemaVersion": "0.1.0", "Vendor": "Docker Inc.", "Version": "v0.0.1", "ShortDescription": "Docker Pod"}`
|
||||
fmt.Println(metadata)
|
||||
|
||||
case "pod":
|
||||
for {
|
||||
message, err := babashka.ReadMessage()
|
||||
if err != nil {
|
||||
babashka.WriteErrorResponse(message, err)
|
||||
continue
|
||||
}
|
||||
|
||||
res, err := docker.ProcessMessage(message)
|
||||
if err != nil {
|
||||
babashka.WriteErrorResponse(message, err)
|
||||
continue
|
||||
}
|
||||
|
||||
describeres, ok := res.(*babashka.DescribeResponse)
|
||||
if ok {
|
||||
babashka.WriteDescribeResponse(describeres)
|
||||
continue
|
||||
}
|
||||
|
||||
if res != "running" {
|
||||
babashka.WriteInvokeResponse(message, res)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user