Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[image-builder] Export image config #5693

Merged
merged 6 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chart/templates/ws-manager-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ data:
{{ if (or $wscomp.templates.prebuild $wscomp.affinity) -}}"prebuildPath": "/workspace-template/prebuild.yaml",{{- end }}
{{ if (or $wscomp.templates.probe $wscomp.affinity) -}}"probePath": "/workspace-template/probe.yaml",{{- end }}
{{ if (or $wscomp.templates.ghost $wscomp.affinity) -}}"ghostPath": "/workspace-template/ghost.yaml",{{- end }}
{{ if (or $wscomp.templates.imagebuild $wscomp.affinity) -}}"imagebuildPath": "/workspace-template/imagebuild.yaml",{{- end }}
{{ if (or $wscomp.templates.regular $wscomp.affinity) -}}"regularPath": "/workspace-template/regular.yaml",{{- end }}
{{ end -}}
"defaultPath": "/workspace-template/default.yaml"
Expand Down
7 changes: 5 additions & 2 deletions components/image-builder-bob/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ sudo mv bin/* /usr/bin

Set things up
```bash
# install oci-tool for inspecting the built image
go install github.com/csweichel/oci-tool@latest

# run a local registry
docker run --rm -d -p 5000:5000 registry:latest

# produce a test image
mkdir -p /tmp/f
cd /tmp/f
echo <<EOF > Dockerfile
cat <<EOF > Dockerfile
FROM alpine:latest
ENV foo=bar
EOF
Expand All @@ -35,4 +38,4 @@ BOB_BASE_REF=localhost:5000/source:latest BOB_TARGET_REF=localhost:5000/target:8

# debug using delve
BOB_BASE_REF=localhost:5000/source:latest BOB_TARGET_REF=localhost:5000/target:83 sudo -E $(which dlv) --listen=:2345 --headless=true --api-version=2 exec $(which bob) build
```
```
9 changes: 8 additions & 1 deletion components/image-builder-bob/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var buildCmd = &cobra.Command{
Use: "build",
Short: "Runs the image build and is configured using environment variables (see pkg/builder/config.go for details)",
Run: func(cmd *cobra.Command, args []string) {
t0 := time.Now()
if os.Geteuid() != 0 {
log.Fatal("must run as root")
}
Expand All @@ -37,7 +38,13 @@ var buildCmd = &cobra.Command{
}
err = b.Build()
if err != nil {
log.WithError(err).Fatal("build failed")
log.WithError(err).Error("build failed")

// make sure we're running long enough to have our logs read
if dt := time.Since(t0); dt < 5*time.Second {
time.Sleep(dt)
}

return
}
},
Expand Down
16 changes: 11 additions & 5 deletions components/image-builder-bob/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ require (
github.com/gitpod-io/gitpod/common-go v0.0.0-00010101000000-000000000000
github.com/gofrs/flock v0.8.0 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/google/go-containerregistry v0.6.0
github.com/moby/buildkit v0.9.0
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.1
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.1.3
go.opencensus.io v0.23.0 // indirect
github.com/spf13/cobra v1.2.1
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
Expand All @@ -21,18 +23,22 @@ require (

require (
github.com/containerd/continuity v0.1.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.7.0 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/docker/cli v20.10.7+incompatible // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v20.10.7+incompatible // indirect
github.com/docker/docker-credential-helpers v0.6.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4-0.20210608040537-544b4180ac70 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/klauspost/compress v1.13.0 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tonistiigi/fsutil v0.0.0-20210609172227-d72af97c0eaf // indirect
Expand All @@ -45,7 +51,7 @@ require (
go.opentelemetry.io/otel/sdk v1.0.0-RC1 // indirect
go.opentelemetry.io/otel/trace v1.0.0-RC1 // indirect
go.opentelemetry.io/proto/otlp v0.9.0 // indirect
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 // indirect
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
Expand Down
Loading