Skip to content

Commit

Permalink
feat: rules rewrite to version v1 (#70)
Browse files Browse the repository at this point in the history
* feat: support gcp artifact registry as repo for pushing helm charts

* fix: helpers load import

* fix: toolchain reference

* fix: add gcloud toolchains

* fix: reference to masmovil_bazel_rules workspace

* fix: use helm toolchain tool as binary

* Revert "fix: use helm toolchain tool as binary"

This reverts commit e7d51af.

* fix: helm toolchain

* Revert "fix: helm toolchain"

This reverts commit 8a4432a.

* fix: helm 3 binary path on helm push rule

* fix: import wrong toolchain name

* upgrade helm to version 3.8

* Replace `@bazel_tools//platforms` with `@platforms//os` (#59)

Context: bazelbuild/bazel#8622

* Update sops to 3.7.3, splitting arm64/amd64 versions for linux/darwin.  Permits sops_decrypt() on M2 Mac (#57)

* feat: update sops

* fix: missing platform os in gcloud toolchain template

* fix: typo

* feat: enable oci_image rules support and bazelmod

* feat: enable bazel.module file

* feat: support custom bazelrc.user config

* feat(helm_chart): support extracting image digest from oci_image rules

* fix: module.bazel declaration

Do not load repositories macro from module.bazel file

* feat: rename module name from com_github_masmovil_bazel_rules to masmovil_bazel_rules

* feat: enable bazel dependencies using bzlmod

* feat: refactor helm toolchains to be used as a bzlmod extension

* feat: reimplement helm package bazel rule

* chore: move helm rules to private dir under helm directory

* feat: support registering helm toolchains via repo rule invokation instead of extension

* feat: remove yq toolchain dependency in favor of aspect_lib toolchain

* fix: do not use helm out name for helm toolchain

* fix: path to invoke helm toolchain binary

* feat: reimplement helm_push rule

* feat: implement toolchain_resolved_type for helm toolchain to be able to be imported from a genrule

* feat: refactor helm_release rule adding new rule attributes to it:
- set attribute

* feat: comment out use of short_path in run rule

* feat: remove unnecessary flags for helm_package

* feat: implement new helm_lint_test macro using sh_test

* fix: typo in helm.bzl definition

* feat: add sops, gcloud and kubectl toolchains

* feat: reimplement sops rule using macro and bazel rule

* feat: adapt kubectl rule to use new toolchain

* feat: simplify gcs upload rule

* feat: implement helm_uninstall rule

* fix: augment arguments in helm_release rule

* feat: refactor helm file names

* feat: reimplement helm chart rule using pkg_tar to make helm package operation reproducible

* feat: use pkg tar to create tgz chart

* feat: support modifying chart manifest using yq

* feat: remove dead code

* feat: remove unused helm sh template

* feat: support chart dependencies through providers

* feat: implements helm_pull repository rull to fetch external helm charts

* feat: add basic lint and build tests for helm_chart rule

* feat: remove dead code

* feat: remove unused args

* tests: support testing charts with dependencies and no chart manifest

* tests: implement integration tests for helm_chart rule

* fix: extract digest from oci images

* feat: refactor test_chart compare to yaml function

* fix: remove unnecessary comment

* test: test chart with dependencies

* test: support diff deps values and chart.yaml manifest

* test: add test of chart with two dependencies

* fix: tests charts

* feat: refactor helm_chart rule implementation

* feat: support images from docker and oci image rules

* feat: upgrade bazel to 6.4.0

* feat: support repoconfig and userpass in helm_pull repo rule

* feat: refactor module extensions to support toolchains install and pull util

* chore: remove unused imports from chart_srcs rule file

* feat: add stamping support in helm chart rule

* feat: support chart dependencies conditions via helm_chart attr

* feat: add path_to_chart additional atttr in helm_chart rule

* feat: use depset for values input in chart_src rule

* feat: add structure to doc rules, macros and providers using stardoc

* feat: add stardoc dependency

* chore: remove gpg toolchain

* doc: add attr and docs for chart_srcs rule

* feat: support additional templates in helm_charts

* docs: add stardoc rules to generate docs for helm rules

* feat: modify how iamge.digest is exposed to helm rule

* docs: improve doc usability for helm rules

* docs: improve typos and redability of some helm rules

* doc: improve example of use docs in helm_pull repository rule

* docs: add documentation for sops, k8s and gcs rules using stardoc

* docs: improve helm_chart docs header info

* docs: improve info about helm_chart arguments

* docs: minor improvements in helm_chart docs

* docs: rename gcs and sops markdown files

* chore: add .DS_Store file to gitignore

* test: remove test directory

* feat: remove unmantained examples dir

* feat: add stamp script used for testing pourposes

* chore: add bzlmod lockfile

* docs: update readme.md

* docs: improve doc definition in helm_lint test

* chore: remove unused repositories folder

* chore: remove unusde internal_deps bzl file

* fix: add missing repositories file

* feat: refactor helm toolchain impl

* feat: refactor all toolchains to be placed inside rules folders

* chore: remove unused legacy files

* feat: update external deps

* feat: move repo stuff to be able to load it from bazel workspace mod

* feat: improve helm_push functionality

* doc: improve readme redability

* feat: support sha256 format in digest files

* feat: remove unnecessary workspace name from imports

* chore: downgrade rules_pkg to version 0.9.1  to fix stardoc dependency

* doc: add info about force repository attr in helm_chart rule

* doc: add info to stamp values in helm_chart values attribute

* fix: hack to propagate visibility to chart rules behind helm_chart macro

* fix: remove duplicated visibility arg in chart_srcs

* fix: remove visibility attr from test rule

* fix: do not use sha256 attr in helm pull repo rule

* fix: use helm args to perform helm pull

* fix: use repo_url instead of repo_name in helm_pull repository rule

* fix: do not append chart_name to helm push command

* fix: remove sha256 attr from helm pull rule

* feat: remove possible BUILD files in chart downlad and expose chart info using dict

* feat(helm-release): avoid adding namespace flag to helm release if no namespace or namespace dep is provided

* fix(helm-release): typo with quotes escape

* fix(gcs_upload): modify subpackage visibility of gcs_upload private folder

* test: comment out deprecated helm_pull test

* doc(helm_release): update md docs for namespace attribute

* fix: remove tgz go deps

* ci: execute unit tests using ci config

* doc: disable write_source_files tests

* fix(docs): use right import of stardoc rule

* docs: update docs generation using new stardoc version

* fix: load yq toolchains

* docs: recover docs generated with stardoc v0.6

* chore: remove legacy workspace file

* chore: enable bzlmod by default

* chore: add bzlmod lockfile changes

* chore: add empty workspace file

* docs: add contribute title to main docs

* chore: change module.bazel version to v1

---------

Co-authored-by: Nick De Cooman <nickdecooman@users.noreply.github.com>
Co-authored-by: Allan Clark <allanc@chickenandporn.com>
  • Loading branch information
3 people authored Nov 20, 2024
1 parent d9660c9 commit d27def2
Show file tree
Hide file tree
Showing 166 changed files with 9,701 additions and 3,736 deletions.
13 changes: 12 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
build --host_force_python=PY2
build --enable_bzlmod

test:ci --workspace_status_command=$GITHUB_WORKSPACE/stamp.sh

# Load any settings specific to the current user.
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
# This needs to be last statement in this
# config, as the user configuration should be able to overwrite flags from this file.
# See https://docs.bazel.build/versions/master/best-practices.html#bazelrc
# (Note that we use .bazelrc.user so the file appears next to .bazelrc in directory listing,
# rather than user.bazelrc as suggested in the Bazel docs)
try-import %workspace%/.bazelrc.user
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.4.0
20 changes: 20 additions & 0 deletions .github/workflows/ci-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
tests:
name: Integration tests
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.9.1
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true
- name: Run integration tests
run: |
bazel test //... --config=ci
35 changes: 0 additions & 35 deletions .github/workflows/integration-tests.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
bazel-*
.idea
.bazelrc.user
.DS_Store
47 changes: 47 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

module(name = "masmovil_bazel_rules", version = "1.0.0", bazel_compatibility = [">=6.0.0"])

bazel_dep(name = "aspect_bazel_lib", version = "2.3.0")

bazel_lib_toolchains = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
use_repo(bazel_lib_toolchains, "yq_toolchains")

bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_pkg", version = "0.9.1")

bazel_dep(name = "rules_oci", version = "1.6.0")
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True)

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci", dev_dependency = True)
oci.pull(
name = "distroless_java",
digest = "sha256:161a1d97d592b3f1919801578c3a47c8e932071168a96267698f4b669c24c76d",
image = "gcr.io/distroless/java17",
)
use_repo(oci, "distroless_java")

toolchains = use_extension("@masmovil_bazel_rules//:extensions.bzl", "toolchains")
toolchains.install()

use_repo(toolchains, "helm_toolchains")
use_repo(toolchains, "sops_toolchains")
use_repo(toolchains, "kubectl_toolchains")
use_repo(toolchains, "gcloud_toolchains")

register_toolchains("@helm_toolchains//:all")
register_toolchains("@sops_toolchains//:all")
register_toolchains("@kubectl_toolchains//:all")
register_toolchains("@gcloud_toolchains//:all")

utils = use_extension("@masmovil_bazel_rules//:extensions.bzl", "utils", dev_dependency = True)
utils.pull(
name = "helm_chart_a",
chart_name = "a_values",
repo_url = "http://localhost:8080/charts",
version = "0.0.0",
)
use_repo(utils, "helm_chart_a")

deps = use_extension("@masmovil_bazel_rules//:deps_extension.bzl", "non_module_dependencies")
use_repo(deps, "io_bazel_rules_docker")
4,932 changes: 4,932 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

Loading

0 comments on commit d27def2

Please sign in to comment.