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

Local and CI Containers #574

Merged
merged 2 commits into from Sep 18, 2023
Merged

Local and CI Containers #574

merged 2 commits into from Sep 18, 2023

Conversation

stonier
Copy link
Collaborator

@stonier stonier commented Sep 15, 2023

🎉 New feature

Bazel containers for VSCode devcontainers (local) and gcr (CI).

Summary

Containers for vscode devcontainer (local) and the GCR (CI) workflows.

The important tidbit here is that the same Dockerfile is sourced for both local and CI workflows.

  • Dockerfile based on focal, installs bazelisk adds user zen, also adds some minor conveniences
  • A devcontainer.json that just reflects the Dockerfile to a local vscode workflow
  • A containers.yml github action that pushes a container built from Dockerfile to the org's GCR

An example run of the action: https://github.com/maliput/maliput/actions/runs/6203150728

The only github configuration needed for this action is:

  • Organisation -> Actions -> General -> Workflow Permissions -> Read and Write
  • Repo -> Actions -> General -> Workflow Permissions -> Read and Write

Our organization and repo were already configured.

NB: I had problems fighting permissions on this. Turns out that you can't 'push' to the GCR from in a PR from a fork, even if your user is in both organization and repo with the correct priveleges.

Test it

Devcontainers

  • Install vscode
  • Launch vscode from the project root (or open it from inside vscode)
  • Reopen in container
  • Open a terminal
  • Build
bazel build //...

Action

Trigger a manual run of the action at https://github.com/maliput/maliput/actions/workflows/containers.yml

Checklist

  • Signed all commits for DCO
  • Added example and/or tutorial - Getting Started instructions in the README
  • Updated documentation (as needed) - README

FYI @liangfok

@stonier stonier changed the title Stonier/ci containers Push a bazel container to the GCR Sep 15, 2023
@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Merging #574 (d2df980) into main (8999b68) will not change coverage.
The diff coverage is n/a.

❗ Current head d2df980 differs from pull request most recent head 2e9230d. Consider uploading reports for the commit 2e9230d to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #574   +/-   ##
=======================================
  Coverage   20.71%   20.71%           
=======================================
  Files         279      279           
  Lines       11762    11762           
  Branches     2920     2920           
=======================================
  Hits         2436     2436           
  Misses       7813     7813           
  Partials     1513     1513           

@stonier stonier changed the title Push a bazel container to the GCR Local and CI Containers Sep 15, 2023
Copy link
Collaborator

@francocipollone francocipollone left a comment

Choose a reason for hiding this comment

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

LGTM! This is great to have, and super easy to set up.

Tested locally:

image

.devcontainer/bazel-zen/Dockerfile Outdated Show resolved Hide resolved
.devcontainer/bazel-zen/Dockerfile Show resolved Hide resolved
.github/workflows/containers.yml Outdated Show resolved Hide resolved
Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
Signed-off-by: Daniel Stonier <d.stonier@gmail.com>
Copy link
Collaborator

@francocipollone francocipollone left a comment

Choose a reason for hiding this comment

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

LGTM!

@stonier stonier merged commit e998ce4 into main Sep 18, 2023
5 checks passed
@stonier stonier deleted the stonier/ci_containers branch September 18, 2023 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants