-
Notifications
You must be signed in to change notification settings - Fork 0
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
Container to wrap tooling and generate package #29
Conversation
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.
Great improvements, thanks!
Dockerfile
Outdated
# Copyright 2022 the Kubeapps contributors. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
FROM node:bullseye |
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.
We better use a BAC image instead with no rolling tags for reproducibility, like FROM bitnami/node:16.16.0
, no?
WORKDIR /usr/src | ||
|
||
# Install Bitnami's Readme generator | ||
RUN git clone --single-branch --no-tags https://github.com/bitnami-labs/readme-generator-for-helm readmenator |
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.
RUN git clone --single-branch --no-tags https://github.com/bitnami-labs/readme-generator-for-helm readmenator | |
RUN git clone --single-branch --depth 1 --no-tags https://github.com/bitnami-labs/readme-generator-for-helm readmenator |
# Install Bitnami's Readme generator | ||
RUN git clone --single-branch --no-tags https://github.com/bitnami-labs/readme-generator-for-helm readmenator | ||
RUN cd ./readmenator && npm install | ||
RUN npm install --global --only=production ./readmenator |
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.
We may want to use the npm ci
command instead to honor the package-lock.json ?
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.
Oddly enough, it does not work for global packages. Will take a look in the future combining ci
with the global modifier.
RUN npm install --global --only=production ./readmenator | ||
|
||
# Install Carvel toolset | ||
RUN bash -c "set -eo pipefail; wget -O- https://carvel.dev/install.sh | bash" |
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.
Does it install kapp-ctrl CLI as well?
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.
These are the binaries installed:
kctrl
ytt
imgpkg
kbld
kapp
kwt
vendir
Dockerfile
Outdated
RUN curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | tee /usr/share/keyrings/helm.gpg > /dev/null | ||
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | \ | ||
tee /etc/apt/sources.list.d/helm-stable-debian.list | ||
RUN apt-get update && apt-get install --yes helm |
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.
What about relying on the helm binary directly instead of the OS packaging system? I mean, for having control of which version we are installing, like:
wget https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz
tar zxf helm-$HELM_VERSION-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/
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.
Agree, will add it.
Dockerfile
Outdated
# Install Docker | ||
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - | ||
RUN add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian bullseye stable" | ||
RUN apt-get update && apt-get install --yes docker-ce docker-ce-cli containerd.io |
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.
also, for reproducibility, perhaps setting sticking to a version is useful, like:
(don't know which versions, though)
RUN apt-get update && apt-get install --yes docker-ce docker-ce-cli containerd.io | |
RUN apt-get update && apt-get install --yes docker-ce=x.y.z docker-ce-cli=x.y.z containerd.io=x.y.z |
Dockerfile
Outdated
RUN curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg | ||
RUN echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | \ | ||
tee /etc/apt/sources.list.d/kubernetes.list | ||
RUN apt-get update && apt-get install --yes kubectl |
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.
Idem with the version:
RUN apt-get update && apt-get install --yes kubectl | |
RUN apt-get update && apt-get install --yes kubectl=x.y.z |
Dockerfile
Outdated
# Install Kind | ||
RUN wget "https://kind.sigs.k8s.io/dl/$KIND_VERSION/kind-$(uname)-$(dpkg --print-architecture)" -O /usr/local/bin/kind | ||
RUN chmod +x /usr/local/bin/kind | ||
RUN kind --version |
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.
Why adding here a check whereas in other binaries we are not doing it?
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.
Oops, development leftover. Will remove.
Dockerfile
Outdated
RUN apt-get update && apt-get install --yes kubectl | ||
|
||
# Install Tanzu CLI | ||
RUN wget "https://github.com/vmware-tanzu/tanzu-framework/releases/download/${TANZU_FW_VERSION}/tanzu-cli-linux-amd64.tar.gz" |
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.
What the fw
in TANZU_FW_VERSION stands for? Why not TANZU_CLI_VERSION? Not really important, though
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.
It stands for "framework", which comes from the actual name of the project: tanzu-framework
. I'll rename it to TANZU_FRAMEWORK_VERSION
.
git push "$git_origin" "tags/$tag" | ||
|
||
echo "Creating release for $tag" | ||
gh release create "$tag" "./$version_with_suffix/package.yaml" "./metadata.yaml" "./README.md" \ |
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.
Should we be installing the GitHub CLI as well in the container?
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 added a comment about it in this PR's description. For the Git+GitHub operations we need valid credentials, which makes things more complex. I decided to have it mostly automated, except this part, that can be improved in a later PR.
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.
Ah, ok... but can't we just run the container and pass through it some env vars with the credentials docker run ... -e XXXX=YYY
? Anyway, ok with the semi-automated way for now.
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.
can't we just run the container and pass through it some env vars with the credentials
Exactly, that will be done in a later PR. I've added a comment in the issue and will leave it opened.
local version_with_suffix="$version$packaging_version_suffix" | ||
local tag="v$version_with_suffix" | ||
git add "./$version_with_suffix" | ||
git commit -m "Adding $tag files" |
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.
Should we also add the -s
and -S
flags to DCO and GPG-sign the commits and tags?
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.
Agree, added issue #31 to do it in a separate PR.
This PR wraps most of the tooling needed to generate the Carvel package into a container.
For whoever needs to publish a new Kubeapps Carvel package, it is not needed anymore to have locally:
Plus it will allow us to automate it, adding it in a CI/GitHub actions pipeline so that the only needed parameter to generate a package will be the desired version.
Only logic part left outside of the container is the actual Git committing and release generation in GitHub, because it needs user identification and authentication. This can be improved later and added into the container logic completely.
Resolves #11