Skip to content

Commit 4994c99

Browse files
Merge branch 'main' into mihaimitrea-db/token-force-refresh
2 parents 468fbc6 + 7500a56 commit 4994c99

166 files changed

Lines changed: 5443 additions & 510 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/actions/setup-build-environment/action.yml‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ runs:
3434
with:
3535
version: "0.8.9"
3636

37+
- name: Install Python versions for tests
38+
run: make install-pythons
39+
shell: bash
40+
3741
- name: Install ruff (Python linter and formatter)
3842
uses: astral-sh/ruff-action@4919ec5cf1f49eff0871dbcea0da843445b837e6 # v3.6.1
3943
with:
4044
version: "0.9.1"
4145
args: "--version"
42-
43-
- name: Pull external libraries
44-
run: |
45-
go mod download
46-
pip3 install wheel==0.45.1
47-
shell: bash

‎.github/conftest/README.md‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Conftest policies for GitHub Actions
2+
3+
This directory contains [Conftest](https://www.conftest.dev/) policies that
4+
validate GitHub Actions [workflows] and [composite actions]. They are evaluated
5+
by the [conftest workflow](../workflows/conftest.yml) on every push and pull
6+
request that touches `.github/`.
7+
8+
## Adding a new rule
9+
10+
1. Create a new `.rego` file under `rules/`.
11+
2. Use `package main` and add violations to `deny`.
12+
3. Include a comment block at the top of the file explaining the rule and how
13+
to fix violations.
14+
4. Push — the conftest workflow picks up new rules automatically.
15+
16+
Note that workflows and composite actions have different YAML schemas.
17+
Workflows define jobs under `jobs.<name>.steps`, while composite actions define
18+
steps under `runs.steps`. Rules that inspect steps must handle both.
19+
20+
## Running locally
21+
22+
```bash
23+
# Install conftest (macOS)
24+
brew install conftest
25+
26+
# Run all policies against workflows and composite actions
27+
conftest test \
28+
.github/workflows/*.yml \
29+
.github/actions/*/action.yml \
30+
--policy .github/conftest/rules
31+
```
32+
33+
## References
34+
35+
- [Conftest](https://www.conftest.dev/) — policy testing tool for configuration files
36+
- [Rego](https://www.openpolicyagent.org/docs/latest/policy-language/) — the policy language used by Conftest and OPA
37+
- [Workflow syntax](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions) — YAML schema for `.github/workflows/*.yml`
38+
- [Composite actions](https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-composite-action) — YAML schema for `action.yml` in composite actions
39+
- [Security hardening](https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions) — GitHub's guide to securing workflows
40+
- [Using third-party actions](https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-third-party-actions) — why pinning to commit SHAs matters
41+
42+
[workflows]: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions
43+
[composite actions]: https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-composite-action
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Action pinning — supply-chain protection
2+
#
3+
# External actions must be pinned to a full 40-character commit SHA.
4+
# Mutable tags like @v1 can be reassigned to point at malicious commits.
5+
# Local composite actions (./...) are exempt.
6+
#
7+
# Good: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
8+
# Bad: actions/checkout@v4
9+
# Bad: actions/checkout@main
10+
#
11+
# How to fix:
12+
# 1. Find the tag you want to pin (e.g. v4.3.1).
13+
# 2. Look up the commit SHA:
14+
# git ls-remote --tags https://github.com/<owner>/<action>.git '<tag>^{}' '<tag>'
15+
# 3. Replace the tag with the SHA and add a comment with the tag name:
16+
# uses: actions/checkout@<sha> # v4.3.1
17+
#
18+
# Always include the "# <tag>" suffix comment so humans can tell which
19+
# version is pinned. This cannot be enforced by conftest (YAML strips
20+
# comments during parsing), so it is a convention to follow manually.
21+
22+
package main
23+
24+
import rego.v1
25+
26+
_is_pinned(ref) if {
27+
regex.match(`^[^@]+@[0-9a-f]{40}$`, ref)
28+
}
29+
30+
_is_local(ref) if {
31+
startswith(ref, "./")
32+
}
33+
34+
# Workflow files: jobs.<name>.steps[].uses
35+
deny contains msg if {
36+
some job_name, job in input.jobs
37+
some i, step in job.steps
38+
step.uses
39+
not _is_local(step.uses)
40+
not _is_pinned(step.uses)
41+
msg := sprintf("%s: step %d: action '%s' must be pinned to a full commit SHA", [job_name, i, step.uses])
42+
}
43+
44+
# Composite actions: runs.steps[].uses
45+
deny contains msg if {
46+
some i, step in input.runs.steps
47+
step.uses
48+
not _is_local(step.uses)
49+
not _is_pinned(step.uses)
50+
msg := sprintf("step %d: action '%s' must be pinned to a full commit SHA", [i, step.uses])
51+
}

‎.github/workflows/conftest.yml‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: conftest
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- '.github/**'
8+
pull_request:
9+
paths:
10+
- '.github/**'
11+
12+
env:
13+
CONFTEST_VERSION: "0.67.0"
14+
CONFTEST_SHA256: "a98cfd236f3cadee16d860fbe31cc6edcb0da3efc317f661c7ccd097164b1fdf"
15+
16+
jobs:
17+
conftest:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
23+
24+
- name: Install conftest
25+
run: |-
26+
curl -fsSL "https://github.com/open-policy-agent/conftest/releases/download/v${CONFTEST_VERSION}/conftest_${CONFTEST_VERSION}_Linux_x86_64.tar.gz" \
27+
-o conftest.tar.gz
28+
echo "${CONFTEST_SHA256} conftest.tar.gz" | sha256sum --check --strict
29+
tar xz -f conftest.tar.gz conftest
30+
sudo mv conftest /usr/local/bin/
31+
32+
- name: Run conftest
33+
shell: bash
34+
run: |-
35+
shopt -s nullglob
36+
conftest test \
37+
.github/workflows/*.yml \
38+
.github/workflows/*.yaml \
39+
.github/actions/*/action.yml \
40+
.github/actions/*/action.yaml \
41+
--policy .github/conftest/rules

‎.github/workflows/push.yml‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -306,37 +306,6 @@ jobs:
306306
exit 1
307307
fi
308308
309-
# Github repo: https://github.com/ajv-validator/ajv-cli
310-
- name: Install ajv-cli
311-
run: npm install -g [email protected]
312-
313-
# Assert that the generated bundle schema is a valid JSON schema by using
314-
# ajv-cli to validate it against bundle configuration files.
315-
# By default the ajv-cli runs in strict mode which will fail if the schema
316-
# itself is not valid. Strict mode is more strict than the JSON schema
317-
# specification. See for details: https://ajv.js.org/options.html#strict-mode-options
318-
# The ajv-cli is configured to use the markdownDescription keyword which is not part of the JSON schema specification,
319-
# but is used in editors like VSCode to render markdown in the description field
320-
- name: Validate bundle schema
321-
run: |
322-
go run main.go bundle schema > schema.json
323-
324-
# Add markdownDescription keyword to ajv
325-
echo "module.exports = function(a) {
326-
a.addKeyword('deprecationMessage');
327-
a.addKeyword('doNotSuggest');
328-
a.addKeyword('markdownDescription');
329-
a.addKeyword('x-databricks-preview');
330-
}" >> keywords.js
331-
332-
for file in ./bundle/internal/schema/testdata/pass/*.yml; do
333-
ajv test -s schema.json -d $file --valid -c=./keywords.js
334-
done
335-
336-
for file in ./bundle/internal/schema/testdata/fail/*.yml; do
337-
ajv test -s schema.json -d $file --invalid -c=./keywords.js
338-
done
339-
340309
validate-python-codegen:
341310
needs: cleanups
342311
runs-on: ubuntu-latest

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,13 @@ jobs:
9898
echo "::add-mask::$accessToken"
9999
echo "AZURE_VAULT_TOKEN=$accessToken" >> $env:GITHUB_ENV
100100
101+
# AzureSignTool is installed from nuget.org (https://www.nuget.org/packages/AzureSignTool/7.0.1)
102+
# Security: On Windows, NuGet verifies repository signatures by default. The package is
103+
# version-pinned and pulled over HTTPS from nuget.org's CDN. Source: https://github.com/vcsjones/AzureSignTool
101104
- name: Install AzureSignTool
102105
shell: pwsh
103106
run: |
104-
dotnet tool install --global AzureSignTool
107+
dotnet tool install --global AzureSignTool --version 7.0.1
105108
106109
- name: Run GoReleaser for Windows
107110
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0

‎Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.22 as builder
1+
FROM alpine:3.22@sha256:55ae5d250caebc548793f321534bc6a8ef1d116f334f18f4ada1b2daad3251b2 as builder
22

33
RUN ["apk", "add", "jq"]
44
RUN ["apk", "add", "bash"]
@@ -13,7 +13,7 @@ ARG ARCH
1313
RUN /build/docker/setup.sh
1414

1515
# Start from a fresh base image, to remove any build artifacts and scripts.
16-
FROM alpine:3.22
16+
FROM alpine:3.22@sha256:55ae5d250caebc548793f321534bc6a8ef1d116f334f18f4ada1b2daad3251b2
1717

1818
ENV DATABRICKS_TF_EXEC_PATH "/app/bin/terraform"
1919
ENV DATABRICKS_TF_CLI_CONFIG_FILE "/app/config/config.tfrc"

‎Makefile‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ links:
7070
checks: tidy ws links
7171

7272

73+
.PHONY: install-pythons
74+
install-pythons:
75+
uv python install 3.9 3.10 3.11 3.12 3.13
76+
7377
# Run short unit and acceptance tests (testing.Short() is true).
7478
.PHONY: test
7579
test: test-unit test-acc
@@ -173,15 +177,15 @@ docs:
173177
INTEGRATION = go run -modfile=tools/go.mod ./tools/testrunner/main.go ${GO_TOOL} gotestsum --format github-actions --rerun-fails --jsonfile output.json --packages "./acceptance ./integration/..." -- -parallel 4 -timeout=2h
174178

175179
.PHONY: integration
176-
integration:
180+
integration: install-pythons
177181
$(INTEGRATION)
178182

179183
.PHONY: integration-short
180-
integration-short:
184+
integration-short: install-pythons
181185
DATABRICKS_TEST_SKIPLOCAL=1 VERBOSE_TEST=1 $(INTEGRATION) -short
182186

183187
.PHONY: dbr-integration
184-
dbr-integration:
188+
dbr-integration: install-pythons
185189
DBR_ENABLED=true go test -v -timeout 4h -run TestDbrAcceptance$$ ./acceptance
186190

187191
# DBR acceptance tests - run on Databricks Runtime using serverless compute

‎NEXT_CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* engine/direct: Fix 400 error when deploying grants with ALL_PRIVILEGES ([#4801](https://github.com/databricks/cli/pull/4801))
1313
* Deduplicate grant entries with duplicate principals or privileges during initialization ([#4801](https://github.com/databricks/cli/pull/4801))
1414
* engine/direct: Fix unwanted recreation of secret scopes when scope_backend_type is not set ([#4834](https://github.com/databricks/cli/pull/4834))
15+
* engine/direct: Fix bind and unbind for non-Terraform resources ([#4850](https://github.com/databricks/cli/pull/4850))
16+
* engine/direct: Fix deploying removed principals ([#4824](https://github.com/databricks/cli/pull/4824))
1517

1618
### Dependency updates
1719

‎NOTICE‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ License - https://github.com/manifoldco/promptui/blob/master/LICENSE.md
7474

7575
This Software contains code from the following open source projects, licensed under the MIT license:
7676

77+
google/jsonschema-go - https://github.com/google/jsonschema-go
78+
Copyright 2025 Google LLC
79+
License - https://github.com/google/jsonschema-go/blob/main/LICENSE
80+
7781
charmbracelet/bubbles - https://github.com/charmbracelet/bubbles
7882
Copyright (c) 2020-2025 Charmbracelet, Inc
7983
License - https://github.com/charmbracelet/bubbles/blob/master/LICENSE

0 commit comments

Comments
 (0)