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

Add OCI & OpenShift labels to Docker image #10007

Merged
merged 2 commits into from
Aug 5, 2022
Merged

Conversation

npepinpe
Copy link
Member

@npepinpe npepinpe commented Aug 5, 2022

Description

This PR adds labels to the Docker image following the OCI and OpenShift specs. This includes modifications to the build process to inject the few values which are dynamic, namely:

  • the created at ISO 8601 timestamp
  • the commit SHA (or revision) of the artifact
  • the semantic version of the artifact

You can find the specs here:

On top of adding labels, this modifies the Dockerfile a bit and pins the production image to specific sha of the base image, ensuring reproducible builds. In the future we should update this sha when need be, and update the golden file (docker/test/docker-labels.golden.json).

This also adds hadolint to lint our Dockerfile and applies some of the recommendations to it. A new code quality job is added, Docker checks, which runs hadolint and verifies that the labels are as expected. The verification is done via a bash script which grabs the labels from a docker inspect, and compares it with an interpolated golden file (since we have a few dynamic values). The comparison is done using diff, so the output should be familiar to most.

Related issues

related to #9940
blocks #10013

Definition of Done

Not all items need to be done depending on the issue and the pull request.

Code changes:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix to the last two minor versions. You can trigger a backport by assigning labels (e.g. backport stable/1.3) to the PR, in case that fails you need to create backports manually.

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually
  • The change has been verified by a QA run
  • The impact of the changes is verified by a benchmark

Documentation:

  • The documentation is updated (e.g. BPMN reference, configuration, examples, get-started guides, etc.)
  • New content is added to the release announcement
  • If the PR changes how BPMN processes are validated (e.g. support new BPMN element) then the Camunda modeling team should be informed to adjust the BPMN linting.

Please refer to our review guidelines.

@npepinpe
Copy link
Member Author

npepinpe commented Aug 5, 2022

Don't worry, I'll split it up into two parts: adding the labels, then updating Jenkins CI, then updating GHA CI.

@npepinpe
Copy link
Member Author

npepinpe commented Aug 5, 2022

@npepinpe
Copy link
Member Author

npepinpe commented Aug 5, 2022

It might be interesting to create a reusable action for building our Docker image now that we have a less straightforward process for building the image.

@npepinpe npepinpe marked this pull request as ready for review August 5, 2022 12:17
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2022

Test Results

   810 files  ±    0     810 suites  ±0   1h 42m 17s ⏱️ - 3m 3s
6 224 tests +159  6 213 ✔️ +159  11 💤 ±0  0 ±0 
6 412 runs  +159  6 401 ✔️ +159  11 💤 ±0  0 ±0 

Results for commit b447062. ± Comparison against base commit bdc2405.

♻️ This comment has been updated with latest results.

@oleschoenburg oleschoenburg self-requested a review August 5, 2022 12:32
Copy link
Member

@oleschoenburg oleschoenburg left a comment

Choose a reason for hiding this comment

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

Cool, thanks for putting so much effort into the verify script 🏅

I only have a few suggestions but nothing that would require another review

.github/workflows/code-quality.yml Show resolved Hide resolved
.github/workflows/code-quality.yml Show resolved Hide resolved
.github/workflows/deploy.yml Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
.ci/scripts/distribution/ensure-naming-for-process.sh Outdated Show resolved Hide resolved
@npepinpe npepinpe force-pushed the 9940-oci-labels branch 8 times, most recently from c1fbdab to 166e0e2 Compare August 5, 2022 14:23
Adds labels to the Docker image following the OCI and OpenShift specs.
This includes modifications to the build process to inject the few
values which are dynamic, namely:
  - the created at ISO 8601 timestamp
  - the commit SHA (or revision) of the artifact
  - the semantic version of the artifact

On top of adding labels, this modifies the `Dockerfile` a bit and pins
the production image to specific sha of the base image, ensuring
reproducible builds. In the future we should update this sha when need
be, and update the golden file
(`docker/test/docker-labels.golden.json`).

This also adds `hadolint` to lint our Dockerfile and applies some of the
recommendations to it. A new code quality job is added, `Docker checks`,
which runs hadolint and verifies that the labels are as expected.
@npepinpe
Copy link
Member Author

npepinpe commented Aug 5, 2022

bors merge

@zeebe-bors-camunda
Copy link
Contributor

Build succeeded:

@zeebe-bors-camunda zeebe-bors-camunda bot merged commit c017448 into main Aug 5, 2022
@zeebe-bors-camunda zeebe-bors-camunda bot deleted the 9940-oci-labels branch August 5, 2022 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants