-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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] Backport mkIII from gitpod-com #4251
Conversation
b08fff7
to
5cfb685
Compare
5be432b
to
f504484
Compare
9abc5c3
to
07d3643
Compare
6ce0835
to
c24d574
Compare
/werft run 👍 started the job as gitpod-build-cw-imgbuilder-mk3.21 |
5cb6552
to
4a02b90
Compare
0110a7b
to
6797b4d
Compare
9a7b1c8
to
ee1bce9
Compare
ee1bce9
to
04af15a
Compare
/werft run 👍 started the job as gitpod-build-cw-imgbuilder-mk3.51 |
Here are some first results of trying this out:
Logs of the imagebuild pod
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've looked over the code. However, due to the amount not everything in detail. What I've seen looks pretty good so far. I have a few minor comments.
I have not been able to test this completely yet (see comment). Don't know if it's just the preview env or whether there is a bug. Would like to run some additional tests when it works again.
"ghost.yaml": | | ||
{{ dict | merge ($comp.templates.ghost | default dict) (include "coreWorkspaceAffinity" (dict "comp" $comp "tpe" "ghost") | fromYaml) | toJson | indent 4 }} | ||
{{- end }} | ||
{{ if (or $comp.templates.imagebuild $comp.affinity) }} | ||
"imagebuild.yaml": | | ||
{{ dict | merge ($comp.templates.ghost | default dict) (include "coreWorkspaceAffinity" (dict "comp" $comp "tpe" "imagebuild") | fromYaml) | toJson | indent 4 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason that it is $comp.templates.ghost
instead of $comp.templates.imagebuild
?
{{ dict | merge ($comp.templates.ghost | default dict) (include "coreWorkspaceAffinity" (dict "comp" $comp "tpe" "imagebuild") | fromYaml) | toJson | indent 4 }} | |
{{ dict | merge ($comp.templates.imagebuild | default dict) (include "coreWorkspaceAffinity" (dict "comp" $comp "tpe" "imagebuild") | fromYaml) | toJson | indent 4 }} |
"wsman": { | ||
"address": "ws-manager:8080", | ||
"tls": { | ||
"ca": "/wsman-certs/ca.crt", | ||
"crt": "/wsman-certs/tls.crt", | ||
"key": "/wsman-certs/tls.key" | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that the selection of the ws-manager is future work but what do you think of at least having something like this:
(However, that's not a blocker, though. Feel free to ignore.)
"wsman": { | |
"address": "ws-manager:8080", | |
"tls": { | |
"ca": "/wsman-certs/ca.crt", | |
"crt": "/wsman-certs/tls.crt", | |
"key": "/wsman-certs/tls.key" | |
} | |
}, | |
{{- if $comp.wsman -}} | |
{{ $comp.wsman | fromYaml | toJson }} | |
{{- else -}} | |
"wsman": { | |
"address": "ws-manager:8080", | |
"tls": { | |
"ca": "/wsman-certs/ca.crt", | |
"crt": "/wsman-certs/tls.crt", | |
"key": "/wsman-certs/tls.key" | |
} | |
}, | |
{{- end -}} |
touch ~/.hushlogin && \ | ||
# Configure shell | ||
BASH_RC=~/.bashrc; if [ -f "$BASH_RC" ]; then cp "$BASH_RC" ~/.bashrc-org; else touch ~/.bashrc-org; fi && \ | ||
cat /var/gitpod/gitpod/.bashrc-prepend > "$BASH_RC" && \ | ||
cat ~/.bashrc-org >> "$BASH_RC" && \ | ||
cat /var/gitpod/gitpod/.bashrc-append >> "$BASH_RC" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Ugly whitespacing.
touch ~/.hushlogin && \ | |
# Configure shell | |
BASH_RC=~/.bashrc; if [ -f "$BASH_RC" ]; then cp "$BASH_RC" ~/.bashrc-org; else touch ~/.bashrc-org; fi && \ | |
cat /var/gitpod/gitpod/.bashrc-prepend > "$BASH_RC" && \ | |
cat ~/.bashrc-org >> "$BASH_RC" && \ | |
cat /var/gitpod/gitpod/.bashrc-append >> "$BASH_RC" | |
touch ~/.hushlogin && \ | |
# Configure shell | |
BASH_RC=~/.bashrc; if [ -f "$BASH_RC" ]; then cp "$BASH_RC" ~/.bashrc-org; else touch ~/.bashrc-org; fi && \ | |
cat /var/gitpod/gitpod/.bashrc-prepend > "$BASH_RC" && \ | |
cat ~/.bashrc-org >> "$BASH_RC" && \ | |
cat /var/gitpod/gitpod/.bashrc-append >> "$BASH_RC" |
} | ||
|
||
func prewarmCache(cl *client.Client, images []string) error { | ||
bld := llb.Image("alpine:latest").Run(llb.Shlex("echo")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love if we could make the alpine:latest
image configurable in the values.yaml
file again.
} | ||
pulllb, err := bld.Marshal(context.Background()) | ||
if err != nil { | ||
log.WithError(err).Fatal("cannot produce iamge pull LLB") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo:
log.WithError(err).Fatal("cannot produce iamge pull LLB") | |
log.WithError(err).Fatal("cannot produce image pull LLB") |
This PR backports the image-builder mkIII from the gitpod-com repo. image-builder mkIII is the third rewrite of image-builder and works fundamentally different to is predecessors:
While its implementation is really different to previous iterations it maintains the same interface and is a drop-in replacement for image-builder mkII.
Note: because this is essentially a backport of previous work it comes in a single commit.
ToDo
Future Work
Known defects
initializerMap
inmonitor.go