Skip to content

fix(ci): remove Go and refactor install nfpm line #3077

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

Closed
wants to merge 2 commits into from

Conversation

jsjoeio
Copy link
Contributor

@jsjoeio jsjoeio commented Apr 8, 2021

Follow-up PR from #3076 (comment)

  • remove Go
  • use @jawnsy's suggestion

@jsjoeio jsjoeio requested a review from a team as a code owner April 8, 2021 21:24
@jsjoeio jsjoeio self-assigned this Apr 8, 2021
RUN VERSION="$(curl -fsSL https://storage.googleapis.com/kubernetes-release/release/stable.txt)" && \
curl -fsSL "https://storage.googleapis.com/kubernetes-release/release/$VERSION/bin/linux/amd64/kubectl" > /usr/local/bin/kubectl \
&& chmod +x /usr/local/bin/kubectl
RUN curl -fsSL https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.$(uname -m).tar.xz \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a Debian package for shellcheck, so you can apt-get install shellcheck here? The current stable release is a little old though: https://packages.debian.org/buster/shellcheck unless you also enable backports: https://packages.debian.org/buster-backports/shellcheck

No worries though, this is fine as it is :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now actually grab shellcheck from npm now, which uses a script that directly downloads/installs it to node_modules - see https://github.com/cdr/code-server/blob/main/package.json#L71 - I landed this in the CI rewrite to make building easier

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! so we can remove the curl line?

I was confused that shellcheck in package.json is v1 while the latest release in GitHub is 0.7.1, and it seems that the npm package just downloads the latest release? This would make the build less reproducible, since shellcheck can can change (and break) without any changes on our part

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh huh yeah good point. I think we wanted to use the npm version to reduce the number of dependencies users have to manually install so maybe we can fork it, make the version static, and publish @coder/shellcheck or something.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we convince the shellcheck people to release versioned releases that correspond with the upstream versions? e.g. [email protected] or something (upstream version 0.71, first version of the npm package) - that would be useful for other people too and means we don't have to maintain our own thing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can do the same for nfpm.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would definitely be better if we could convince upstream! Seems the maintainer is open to proposals: gunar/shellcheck#24 (comment)

Copy link
Member

@code-asher code-asher Apr 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main concern was that since 1.0.0 is already published it seems a bit sketchy.

apt-get update && apt-get install -y yarn
RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update && apt-get install -y yarn

# Installs VS Code build deps.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I think we should condense these RUN commands, each one creates a separate copy-on-write layer and this can lead to "wasted" space. Not something to do now, but just something to keep in mind for the future :)

When you install packages or run an update, apt creates cache files in /var/cache/apt and some other places (it's downloaded packages and the package list), and these consume space in the container image unless you remove them in the same layer (using apt-get clean). There's a magic hook in the Debian docker image that does this automatically, but it's usually better to be explicit (update, install, and clean all in the same step) rather than rely on that magic.

https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

https://dev.to/cloudx/analyzing-the-docker-layers-with-dive-5e7o

@jsjoeio jsjoeio added this to the v3.9.4 milestone Apr 8, 2021
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that CI has been refactored the only place this is used is in run.sh right? Does anyone here actually use the Docker container for development? I wonder if it even makes sense to maintain.

&& rm -R shellcheck*

# Using GitHub release URL is better because now only rely on one service instead of GitHub and install.goreleaser.com
RUN curl -sSL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_Linux_x86_64.tar.gz | tar -C /tmp -zxv nfpm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to use the same architecture logic we used for fetching the go binary.

RUN curl -sSL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_Linux_x86_64.tar.gz | tar -C /tmp -zxv nfpm

RUN VERSION="$(curl -fsSL https://storage.googleapis.com/kubernetes-release/release/stable.txt)" \
&& curl -fsSL "https://storage.googleapis.com/kubernetes-release/release/$VERSION/bin/linux/amd64/kubectl" >/usr/local/bin/kubectl \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't introduced by your PR but we should use the detected architecture here as well.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Apr 12, 2021

Now that CI has been refactored the only place this is used is in run.sh right? Does anyone here actually use the Docker container for development? I wonder if it even makes sense to maintain.

Oh! I didn't even realize it but you're right. I don't use it for development. Not sure if others do, but I would be in favor of closing this PR and removing ci/images/debian10/Dockerfile.

Not sure if run.sh is even used?

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Apr 14, 2021

Closing in favor of #3134

@jsjoeio jsjoeio closed this Apr 14, 2021
@jsjoeio jsjoeio deleted the jsjoeio/remove-go branch April 14, 2021 23:24
@jsjoeio jsjoeio added the chore Related to maintenance or clean up label May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Related to maintenance or clean up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants