diff --git a/.github/workflows/test-chart.yaml b/.github/workflows/test-chart.yaml new file mode 100644 index 0000000000..8779a0bf48 --- /dev/null +++ b/.github/workflows/test-chart.yaml @@ -0,0 +1,44 @@ +name: test-chart + +on: + pull_request: + paths: + - 'chart/**' + - '!chart/**.md' + +jobs: + lint-test-chart: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Helm + uses: azure/setup-helm@v2.0 + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Setup chart-testing + uses: helm/chart-testing-action@v2.2.0 + + - name: Run chart-testing (list-changed) + id: list-changed + run: | + changed=$(ct list-changed --config ct.yaml) + if [[ -n "$changed" ]]; then + echo "::set-output name=changed::true" + fi + + - name: Run chart-testing (lint) + run: ct lint --config ct.yaml + + - name: Create kind cluster + uses: helm/kind-action@v1.2.0 + + - name: Run chart-testing (install) + run: ct install --config ct.yaml diff --git a/.gitignore b/.gitignore index bf36ec5ac2..736fa4a401 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.swp ./**/*.class ./out/* +.actrc .DS_Store .classpath .editorconfig diff --git a/CHANGELOG.md b/CHANGELOG.md index 162f16dadf..275d3653cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Add MDC to the `LoggingMdcFilter` to include API method, path, and request ID [@fm100](https://github.com/fm100) * Add Postgres sub-chart to Helm deployment for easier installation option [@KevinMellott91](https://github.com/KevinMellott91) +* GitHub Action workflow to validate changes to Helm chart [@KevinMellott91](https://github.com/KevinMellott91) ### Changed diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe444ee70b..a2e5368c08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,9 +8,9 @@ We're excited you're interested in contributing to Marquez! We'd love your help, * Fix or improve documentation * For newcomers, pick up a ["good first issue"](https://github.com/MarquezProject/marquez/labels/good%20first%20issue), then send a pull request our way (see the [resources](#resources) section below for helpful links to get started) -We feel that a welcoming community is important and we ask that you follow the [Contributor Covenant Code of Conduct](https://github.com/MarquezProject/marquez/blob/main/CODE_OF_CONDUCT.md) in all interactions with the community. - -If you’re interested in using or learning more about Marquez, reach out to us on our [slack](http://bit.ly/MarquezSlack) channel and follow [@MarquezProject](https://twitter.com/MarquezProject) for updates. We also encourage new comers to [join](https://lists.lfaidata.foundation/g/marquez-technical-discuss/ics/invite.ics?repeatid=32038) our monthly community meeting! +We feel that a welcoming community is important and we ask that you follow the [Contributor Covenant Code of Conduct](https://github.com/MarquezProject/marquez/blob/main/CODE_OF_CONDUCT.md) in all interactions with the community. + +If you’re interested in using or learning more about Marquez, reach out to us on our [slack](http://bit.ly/MarquezSlack) channel and follow [@MarquezProject](https://twitter.com/MarquezProject) for updates. We also encourage new comers to [join](https://lists.lfaidata.foundation/g/marquez-technical-discuss/ics/invite.ics?repeatid=32038) our monthly community meeting! # Getting Your Changes Approved @@ -62,6 +62,53 @@ To setup the git hook scripts run: $ pre-commit install ``` +# `.github/workflows` + +Each Pull Request executes a series of quality checks, mostly relying upon CircleCI for validation. However, there are +certain validation checks that execute via GitHub Actions and can be run locally using the steps below. + +Install [act](https://github.com/nektos/act) and run the following command, which will evaluate the GitHub Actions +checks that apply to each Pull Request. The first time you run _act_ you will be asked to choose a +[runner](https://github.com/nektos/act#runners). + +Alternatively, you can store your preferred runner within a local user profile named _.actrc_. + +```bash +# .actrc file example (https://github.com/nektos/act#configuration) +-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest +``` + +Once you have configured a runner, use _act_ to invoke GitHub Actions and evaluate the workflow. + +```bash +act pull_request +``` + +You can also enable verbose logging and image caching via [act flags](https://github.com/nektos/act#flags). + +```bash +act pull_request --reuse --verbose +``` + +> **Note:** Docker must be running in order to utilize _act_. + +## Troubleshooting + +There is an issue within the _act_ tool that prevents the _kind_ cluster from being deleted after execution the action. +When this condition exists, you will experience the error below. + +```bash +| Creating kind cluster... +| ERROR: failed to create cluster: node(s) already exist for a cluster with the name "chart-testing" +[Lint and Test Chart/lint-test] ❌ Failure - Create kind cluster +``` + +Execute the command below to manually clean up the _kind_ cluster and resolve the problem. + +```bash +kind delete clusters chart-testing +``` + # Publish to Local Maven Repository Use [`publishToMavenLocal`](https://docs.gradle.org/current/userguide/publishing_maven.html#publishing_maven:tasks) to publish artifacts to your local maven repository: @@ -112,14 +159,14 @@ To ensure your pull request is accepted, follow these guidelines: * Choose _short_ and _descriptive_ branch names * Use dashes (`-`) to separate _words_ in branch names -* Use _lowercase_ in branch names - -# Dependencies - -We use [renovate](https://github.com/renovatebot/renovate) to manage dependencies for most of our project modules, -with a couple of exceptions. Renovate automatically detects new dependency versions, and opens pull -requests to upgrade dependencies in accordance to the [configured rules](https://github.com/MarquezProject/marquez/blob/main/renovate.json). - +* Use _lowercase_ in branch names + +# Dependencies + +We use [renovate](https://github.com/renovatebot/renovate) to manage dependencies for most of our project modules, +with a couple of exceptions. Renovate automatically detects new dependency versions, and opens pull +requests to upgrade dependencies in accordance to the [configured rules](https://github.com/MarquezProject/marquez/blob/main/renovate.json). + The following dependencies are managed manually * _Web code_ - it is challenging to programmatically validate web content @@ -163,7 +210,7 @@ Then browse to: http://localhost:8080 # Resources * [How to Contribute to Open Source](https://opensource.guide/how-to-contribute) -* [Using the Fork-and-Branch Git Workflow](https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow) +* [Using the Fork-and-Branch Git Workflow](https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow) * [Understanding the GitHub flow](https://guides.github.com/introduction/flow/) * [Keep a Changelog](https://keepachangelog.com) * [Code Review Developer Guide](https://google.github.io/eng-practices/review) diff --git a/chart/Chart.lock b/chart/Chart.lock index 49234e09e5..ee178c9b35 100644 --- a/chart/Chart.lock +++ b/chart/Chart.lock @@ -5,5 +5,5 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami version: 10.16.2 -digest: sha256:b3681ea701f2a32b4a9dd7028a9a884a57244031f033d671c49e9612b03e12ac -generated: "2022-02-02T16:58:56.272901-06:00" +digest: sha256:1b0fb36bbcf6b6304b07650f0808a8ac153d785badcb279f7a14cdfb3a4e25cb +generated: "2022-02-07T17:42:27.94682-06:00" diff --git a/chart/ci/ci-values.yaml b/chart/ci/ci-values.yaml new file mode 100644 index 0000000000..8baf122d51 --- /dev/null +++ b/chart/ci/ci-values.yaml @@ -0,0 +1,4 @@ +## These value overrides are used within the GitHub Actions CI validation. +## +postgresql: + enabled: true diff --git a/chart/templates/marquez/deployment.yaml b/chart/templates/marquez/deployment.yaml index 389da23175..9da6b73f16 100644 --- a/chart/templates/marquez/deployment.yaml +++ b/chart/templates/marquez/deployment.yaml @@ -20,6 +20,23 @@ spec: labels: {{- include "common.labels.standard" . | nindent 8 }} app.kubernetes.io/component: marquez spec: + {{- if .Values.postgresql.enabled }} + # This init container is for avoiding CrashLoopback errors in the Marquez container because the PostgreSQL container is not ready + initContainers: + - name: wait-for-db + image: postgres:12.1 + imagePullPolicy: IfNotPresent + command: + - /bin/bash + args: + - -ec + - until pg_isready -h ${POSTGRES_HOST} -p ${POSTGRES_PORT}; do echo waiting for database; sleep 2; done; + env: + - name: POSTGRES_HOST + value: {{ include "marquez.database.host" . | quote }} + - name: POSTGRES_PORT + value: {{ include "marquez.database.port" . | quote }} + {{- end }} containers: - name: {{ .Chart.Name }} image: {{ include "marquez.image" . }} diff --git a/chart/values.yaml b/chart/values.yaml index 08dc0c5a77..804c7e1ef5 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -96,6 +96,16 @@ postgresql: ## @param postgresql.enabled Deploy PostgreSQL container(s) ## enabled: false + ## Bitnami PostgreSQL image version + ## ref: https://hub.docker.com/r/bitnami/postgresql/tags/ + ## @param image.registry PostgreSQL image registry + ## @param image.repository PostgreSQL image repository + ## @param image.tag PostgreSQL image tag (immutable tags are recommended) + ## + image: + registry: docker.io + repository: bitnami/postgresql + tag: 12.1.0 ## @param postgresql.postgresqlUsername PostgreSQL username ## ref: https://hub.docker.com/_/postgres/ ## diff --git a/ct.yaml b/ct.yaml new file mode 100644 index 0000000000..6e8f97d7f9 --- /dev/null +++ b/ct.yaml @@ -0,0 +1,9 @@ +# See https://github.com/helm/chart-testing#configuration +remote: origin +target-branch: main +charts: + - chart +chart-repos: + - bitnami=https://charts.bitnami.com/bitnami +helm-extra-args: "--timeout 600s" +validate-maintainers: false \ No newline at end of file