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

Policy remediations SDK support #314

Merged
merged 30 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
16a63fb
Add support for policy transforms
joeduffy Sep 30, 2023
c2c4533
Add remediation support to the Python SDK
joeduffy Sep 30, 2023
adcdcc2
Simplify, and add diagnostics support for unknowns
joeduffy Sep 30, 2023
56ee97b
Tidy up some leftovers
joeduffy Oct 1, 2023
d811540
Rename transforms to remediations (Node.js)
joeduffy Oct 5, 2023
67e5065
Rename transforms to remediations (Python)
joeduffy Oct 5, 2023
cea1211
Rename combined func
joeduffy Oct 6, 2023
6114842
Add a secrets preserving proxy (Node.js)
joeduffy Oct 7, 2023
59624dd
Fix some lint errors
joeduffy Oct 7, 2023
6baf3d2
Implement secrets round-tripping for Python SDK
joeduffy Oct 7, 2023
fbcc17d
Use a Secret tombstone, rather than serialization gunk
joeduffy Oct 7, 2023
a5160ec
Incorporate code review feedback
joeduffy Oct 7, 2023
225dc41
Fix Python linting errors
joeduffy Oct 7, 2023
73f56da
Allow users to wrap Secrets too
joeduffy Oct 7, 2023
1da8226
Add CHANGELOG entry
joeduffy Oct 7, 2023
d0fdaf4
Undo module rename
joeduffy Oct 7, 2023
80b40e6
Revise the README slightly
joeduffy Oct 7, 2023
e116591
Get tests back to green
joeduffy Oct 7, 2023
0175f7d
Add unit tests for Policy Node.js SDK
joeduffy Oct 7, 2023
ea3041c
Add Python SDK remediation unit tests
joeduffy Oct 8, 2023
835abb3
Add some remediation integration tests
joeduffy Oct 8, 2023
c5939c8
Add more integration tests, unskip tests disabled eons ago
joeduffy Oct 8, 2023
2cb81f9
Apply suggestions from code review
joeduffy Oct 9, 2023
bdc3d3b
Remove debug log
joeduffy Oct 9, 2023
223a7f8
Run workflows on Node 18.x; install Pulumi v3.88.0 or greater
justinvp Oct 10, 2023
e483e3d
Update deps in package.json
justinvp Oct 10, 2023
63bdbff
Update python deps
justinvp Oct 10, 2023
38a9289
Adjust tests for new CLI output
justinvp Oct 10, 2023
8c8b131
Remove line that shouldn't have been added
justinvp Oct 10, 2023
37ff58c
Add missing spaces from new expected CLI output
justinvp Oct 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ env:
PULUMI_API: https://api.pulumi-staging.io
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
VERSION: ${{ github.event.client_payload.ref }}
VERSION: ${{ github.event.client_payload.ref }}
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node-version}}
registry-url: https://registry.npmjs.org
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv pip requests wheel urllib3 chardet
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
uses: jaxxstorm/action-install-gh-release@v1.5.0
with:
repo: pulumi/pulumictl
- name: Checkout Repo
Expand All @@ -46,6 +46,13 @@ jobs:
- name: Lint Python
run: |
cd sdk/python && make lint
strategy:
fail-fast: true
matrix:
platform: [ ubuntu-latest ]
go-version: [ 1.18.x ]
python-version: [ 3.9.x ]
node-version: [ 18.x ]
build_test_publish:
name: Build, Test, and Publish
runs-on: ubuntu-latest
Expand All @@ -55,22 +62,24 @@ jobs:
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.5.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/action-install-pulumi-cli@v1.0.1
uses: pulumi/actions@v4
with:
pulumi-version: ">=3.88.0"
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node-version}}
registry-url: https://registry.npmjs.org
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
- name: Install pipenv
Expand Down Expand Up @@ -115,7 +124,7 @@ jobs:
platform: [ ubuntu-latest ]
go-version: [ 1.18.x ]
python-version: [ 3.9.x ]
node-version: [ 14.x ]
node-version: [ 18.x ]
name: master
"on":
push:
Expand Down
29 changes: 19 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node-version}}
registry-url: https://registry.npmjs.org
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv pip requests wheel urllib3 chardet
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
uses: jaxxstorm/action-install-gh-release@v1.5.0
with:
repo: pulumi/pulumictl
- name: Checkout Repo
Expand All @@ -46,6 +46,13 @@ jobs:
- name: Lint Python
run: |
cd sdk/python && make lint
strategy:
fail-fast: true
matrix:
platform: [ ubuntu-latest ]
go-version: [ 1.18.x ]
python-version: [ 3.9.x ]
node-version: [ 18.x ]
build_test_publish:
name: Build, Test, and Publish
runs-on: ubuntu-latest
Expand All @@ -55,22 +62,24 @@ jobs:
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.5.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/action-install-pulumi-cli@v1.0.1
uses: pulumi/actions@v4
with:
pulumi-version: ">=3.88.0"
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node-version}}
registry-url: https://registry.npmjs.org
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
- name: Install pipenv
Expand Down Expand Up @@ -106,14 +115,14 @@ jobs:
platform: [ ubuntu-latest ]
go-version: [ 1.18.x ]
python-version: [ 3.9.x ]
node-version: [ 14.x ]
node-version: [ 18.x ]
create_docs_build:
name: Create docs build
needs: build_test_publish
runs-on: ubuntu-latest
steps:
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.5.0
with:
repo: pulumi/pulumictl
- env:
Expand Down
27 changes: 18 additions & 9 deletions .github/workflows/run-acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node-version}}
registry-url: https://registry.npmjs.org
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv pip requests wheel urllib3 chardet
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.2.0
uses: jaxxstorm/action-install-gh-release@v1.5.0
with:
repo: pulumi/pulumictl
- name: Checkout Repo
Expand All @@ -60,6 +60,13 @@ jobs:
- name: Lint Python
run: |
cd sdk/python && make lint
strategy:
fail-fast: true
matrix:
platform: [ ubuntu-latest ]
go-version: [ 1.18.x ]
python-version: [ 3.9.x ]
node-version: [ 18.x ]
build_and_test:
name: Build and Test SDK
runs-on: ${{ matrix.platform }}
Expand All @@ -72,22 +79,24 @@ jobs:
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install pulumictl
uses: jaxxstorm/action-install-gh-release@v1.1.0
uses: jaxxstorm/action-install-gh-release@v1.5.0
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/action-install-pulumi-cli@v1.0.1
uses: pulumi/actions@v4
with:
pulumi-version: ">=3.88.0"
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node-version}}
registry-url: https://registry.npmjs.org
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
- name: Install pipenv
Expand All @@ -114,7 +123,7 @@ jobs:
platform: [ ubuntu-latest ]
go-version: [ 1.18.x ]
python-version: [ 3.9.x ]
node-version: [ 14.x ]
node-version: [ 18.x ]
name: Run Acceptance Tests from PR
on:
repository_dispatch:
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## HEAD (Unreleased)
_(none)_

- Add support for policy remediations (https://github.com/pulumi/pulumi-policy/pull/314).

---

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
Define and manage policy for cloud resources deployed through Pulumi.

Policy rules run during `pulumi preview` and `pulumi up`, asserting that cloud resource definitions
comply with the policy immediately before they are created or updated.
comply with the policy immediately before they are created or updated. Policies may optionally define
remediations that automatically fix policy violations rather than issue warnings.

During `preview`, every rule is run on every resource, and policy violations are batched up
into a final report. During the update, the first policy violation will halt the deployment.

Policy violations can have enforcement levels that are **advisory**, which results in a printed
warning, or **mandatory**, which results in an error after `pulumi preview` or `pulumi up` completes.
The enforcement level **remediate** is stronger than both and enables automatic remediations.

## Getting Started

Expand Down
Loading