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

Add Snyk policy example #1624

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Add Snyk policy example #1624

wants to merge 1 commit into from

Conversation

jkodroff
Copy link
Member

@jkodroff jkodroff commented Mar 22, 2024

Made A Deliberate Choice (TM) to put this in the root directory instead of under policy-packs.

Joe and Luke's review is optional, since I know they are busy.

Copy link

🍹 The Update for pulumi/k8s-ci-cluster/0fb933aabe27510488b11577549a7652284b9f20-1743 was successful.

Resource Changes

    Name                                                          Type                                        Operation
+   k8s-ci-cluster-0fb933aabe27510488b11577549a7652284b9f20-1743  pulumi:pulumi:Stack                         create
+   multicloud                                                    pulumi-kubernetes:ci:GkeCluster             create
+   password                                                      random:index/randomPassword:RandomPassword  create
+   ephemeral-ci-cluster                                          gcp:container/cluster:Cluster               create
+   primary-node-pool                                             gcp:container/nodePool:NodePool             create
+   gke                                                           pulumi:providers:kubernetes                 create

Copy link

🍹 The Destroy for pulumi/k8s-ci-cluster/0fb933aabe27510488b11577549a7652284b9f20-1743 was successful.

Resource Changes

    Name                                                          Type                                        Operation
-   gke                                                           pulumi:providers:kubernetes                 delete
-   primary-node-pool                                             gcp:container/nodePool:NodePool             delete
-   ephemeral-ci-cluster                                          gcp:container/cluster:Cluster               delete
-   multicloud                                                    pulumi-kubernetes:ci:GkeCluster             delete
-   password                                                      random:index/randomPassword:RandomPassword  delete
-   k8s-ci-cluster-0fb933aabe27510488b11577549a7652284b9f20-1743  pulumi:pulumi:Stack                         delete

@jkodroff jkodroff requested a review from desteves March 25, 2024 14:27
Copy link
Member

@cnunciato cnunciato left a comment

Choose a reason for hiding this comment

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

Generally looks good, couple bits of initial feedback for ya.


```bash
cd infra
pulumi preview --policy-pack ../policy
Copy link
Member

Choose a reason for hiding this comment

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

We should probably mention here:

  • Ensure the Docker deamon is running
  • npm install && npm -C ../policy install
  • pulumi stack init dev (or whatever)

Comment on lines +22 to +23
cd infra
pulumi preview --policy-pack ../policy --policy-pack-config policy-config.json
Copy link
Member

Choose a reason for hiding this comment

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

When I run this, I get the following error. Expected?

Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/christian-pulumi-corp/snyk-container-scan-policy-ts/dev/previews/45a17a21-3daf-45f6-abd9-38f60d8de683

Loading policy packs...

     Type                   Name                               Plan       Info
 +   pulumi:pulumi:Stack    snyk-container-scan-policy-ts-dev  create     1 error; 2 messages
 +   ├─ docker:index:Image  alpine                             create     
 +   └─ docker:index:Image  debian                             create     1 error

Policies:
    ✅ [email protected] (local: ../policy)

Diagnostics:
  pulumi:pulumi:Stack (snyk-container-scan-policy-ts-dev):
    (node:11647) DeprecationWarning: Calling start() is no longer necessary. It can be safely omitted.
    (Use `node --trace-deprecation ...` to show where the warning was created)

    error: preview failed

  docker:index:Image (debian):
    error: Preview failed: error reading build output: failed to register layer: write /var/cache/debconf/templates.dat: no space left on device

@@ -0,0 +1,71 @@
# snyn-container-scan-policy

Scan Pulumi-managed Docker containers with Snyk and Pulumi Policy as Code:
Copy link
Member

Choose a reason for hiding this comment

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

Suggest adding just a slight but of intro here that makes it clear this is an example that shows how to do this, rather than a tool for doing this, if that makes sense.

@jkodroff jkodroff marked this pull request as draft March 26, 2024 20:52
@jkodroff
Copy link
Member Author

Putting this into draft as I'm likely going to pivot a bit to publish the policy in its own repo and consume it as an npm package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants