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

Build documentation and storage-operator inside containers #1846

Merged
merged 20 commits into from
Oct 5, 2019

Conversation

slaperche-scality
Copy link
Contributor

Component:

buildchain, ci

Context:

Some people just want to build a MetalK8s ISO and be done with it, thus requiring them to install developer dependencies such as Go toolchain and LaTeX distribution is perfectible™

Summary:

  • rework the handling of "build container" (a.k.a. builder) in the buildchain
  • rework doc-building tasks to use a builder
  • rework go-buidling tasks to use a builder
  • revert some changes that were made in the CI to build Go code and PDF doc

Note that we only move build-related task inside a container, things such as live doc rendering and Go codegen/linting still requires you to have dev dependencies (which is acceptable).

Acceptance criteria:

You can build an ISO without Go, Operator SDK or LaTeX installed on your machine.


Closes: #839
Closes: #1830
Closes: #1831

Both built and converted packages depends on the same set of tasks
(create the destination directory and build the builder image).

Refs: #1830
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
Mimic what was done for packages.

Refs: #1830
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
Since we will add more builder images (for doc, for Go stuff, …), let's
add a module dedicated to them.

Refs: #1830
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
Most of the images are built using the directory of the Dockerfile as
build context, but some images need a different context (like the image
to build the documentation: it needs the `tox.ini` which lives at the
root of the repository, while the Dockerfile lays in the `docs`
sub-directory).

Refs: #1830
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
We want to build the documentation inside a container. That way:
- peoples can build PDF documentation without having to install a huge
  LaTeX distribution.
- we can simplify the CI workflow (can build the doc from inside the
  builder image because there is no need for extra dependencies), e.g.
  removing CI-specific hack in the buildchain code.

Refs: #1830
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
Some classes are really too simple (that's why pylint was complaining
about `too-few-public-methods`) so let's replace them by simple
functions (less boilerplate + pylint doesn't complain anymore)

Refs: #1830
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
This will allow to have a better up-to-date definition for the images we
build but that are not shipped in the ISO (for now we are using a
`touch`ed file, which is perfectible™).

Refs: #839
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
Until now, we were relying on a `touch`ed file on disk to know if we had
built the Docker image.
This is perfectible™ and doesn't handle the case where one delete
manually the image through Docker.

This commit adds a custom `uptodate` predicate that checks if the image
is present in the local Docker registry, which is more reliable.

Closes: #839
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
If we want to build the docs inside a container, we must chown back the
generated files, otherwise they will be owned by root.

Refs: #1830
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
We can no longer relies on `get_entrypoint_mount` because we will have
entrypoint unrelated to packaging.

So, instead of using a set of constant for the default configuration we
introduce a new helper that generate a default configuration from the
entrypoint path (for packaging entrypoints we had new constants because
they are referenced in several files).

Refs: #1830
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
This reverts commit f2b6b4b.

We will now use a container to build the documentation, thus we can now
build the doc during the `build` step in the CI instead of reusing the
doc generated during the `doc` step.
Eventually, we will get rid of this `doc` step.

Refs: #1830
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
This reverts commit 7ccc893.

Since we are now using a container to build the documentation, we can
build it for the ISO in the `build` step directly and simplify the CI
workflow.

Refs: #1830
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
This will avoid the installation of deps locally for the devs.

Refs: #1830
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
Like for documentation, avoid requiring people to install Go (and the
deps for the Operator SDK) if they just want to build the ISO (and not
actually hack on the code).
Will also ensure that everyone use a single version of Go to build,
which avoids weird discrepencies (see Go 1.12 vs Go 1.13 behavior w.r.t.
the fix for the thrift apache repository…)

Refs: #1831
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
The Go build container use Go 1.13, update the go.{mod,sum} accordingly.

Refs: #1831
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
If we want to build the docs inside a container, we must chown back
the generated files, otherwise they will be owned by root.

Note that since we are using an Alpine image, we are using `sh` (`bash`
is not installed by default), but given the simplicity or our script
that's not an issue.

Refs: #1831
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
The targets module imports too many things, and we end up with a cyclic
import:

       buildchain.builder
    -> buildchain.targets
    -> buildchain.targets.operator_image

In other words: `builder` import `operator_image` through `targets`, but
`operator_image` also import `builder` (to use the GO_BUILDER`): cycle!!

Closes: #1831
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
This reverts commit 4d94cfc.

Since we are now building the storage-operator using a dedicated
container, we no longer need this commit.

Refs: #1831
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
Continuation of the previous commit.

Refs: #1831
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
We no longer depends on Go and Operator SDK to build the ISO (because we
use a container).

Closes: #1831
Signed-off-by: Sylvain Laperche <sylvain.laperche@scality.com>
@slaperche-scality slaperche-scality added topic:ci Continuous integration and build orchestration topic:build Anything related to building steps labels Oct 4, 2019
@slaperche-scality slaperche-scality requested a review from a team as a code owner October 4, 2019 12:12
@bert-e
Copy link
Contributor

bert-e commented Oct 4, 2019

Hello slaperche-scality,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Status report is not available.

@bert-e
Copy link
Contributor

bert-e commented Oct 4, 2019

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • one peer

Peer approvals must include at least 1 approval from the following list:

@github-actions github-actions bot added kind:dependencies Pull requests that update a dependency file topic:docs Documentation topic:storage Issues related to storage labels Oct 4, 2019
Copy link
Contributor

@jbertran jbertran left a comment

Choose a reason for hiding this comment

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

Damn, nice work. You tackled everything I wanted to tackle in my ancient docker PR, I'll remove that one.

@slaperche-scality
Copy link
Contributor Author

slaperche-scality commented Oct 4, 2019

Damn, nice work. You tackled everything I wanted to tackle in my ancient docker PR, I'll remove that one.

Thanks 🙂

Everything but the rm from the local registry!
It wasn't really related to this PR (whereas removing the touched file was a nice addition since I'll reworking this part anyway) so I left it aside.

You may want to reopen a PR for that part (seems like the weird CI you had disappeared, maybe related to the dind update…)

@slaperche-scality
Copy link
Contributor Author

/approve

@bert-e
Copy link
Contributor

bert-e commented Oct 4, 2019

In the queue

The changeset has received all authorizations and has been added to the
relevant queue(s). The queue(s) will be merged in the target development
branch(es) as soon as builds have passed.

The changeset will be merged in:

  • ✔️ development/2.4

The following branches will NOT be impacted:

  • development/1.0
  • development/1.1
  • development/1.2
  • development/1.3
  • development/2.0
  • development/2.1
  • development/2.2
  • development/2.3

There is no action required on your side. You will be notified here once
the changeset has been merged. In the unlikely event that the changeset
fails permanently on the queue, a member of the admin team will
contact you to help resolve the matter.

IMPORTANT

Please do not attempt to modify this pull request.

  • Any commit you add on the source branch will trigger a new cycle after the
    current queue is merged.
  • Any commit you add on one of the integration branches will be lost.

If you need this pull request to be removed from the queue, please contact a
member of the admin team now.

The following options are set: approve

@bert-e
Copy link
Contributor

bert-e commented Oct 5, 2019

I have successfully merged the changeset of this pull request
into targetted development branches:

  • ✔️ development/2.4

The following branches have NOT changed:

  • development/1.0
  • development/1.1
  • development/1.2
  • development/1.3
  • development/2.0
  • development/2.1
  • development/2.2
  • development/2.3

Please check the status of the associated issue None.

Goodbye slaperche-scality.

@bert-e bert-e merged commit 24ba603 into development/2.4 Oct 5, 2019
@bert-e bert-e deleted the improvement/1830-build-stuff-in-container branch October 5, 2019 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:dependencies Pull requests that update a dependency file topic:build Anything related to building steps topic:ci Continuous integration and build orchestration topic:docs Documentation topic:storage Issues related to storage
Projects
None yet
3 participants