GithubHelp home page GithubHelp logo

Comments (6)

msorens avatar msorens commented on July 30, 2024 1

Your suspicion was 100% correct -- I had neglected to pass environment variables on the command-line. Once I did that, it connects to the right project and uses the correct policy. Thanks!!

from semgrep-action.

mschwager avatar mschwager commented on July 30, 2024

Hi @msorens,

It looks like this functionality went in in https://github.com/returntocorp/semgrep-action/pull/120.

I suspect a few things could be going on here, but I'll need a bit more information to confirm:

  • Are you running the latest version of returntocorp/semgrep-action? It looks like the v1 tag is updated on every commit: https://github.com/returntocorp/semgrep-action/tags, but you may need a docker pull returntocorp/semgrep-action:v1.
  • Can you copy your environment information here? E.g. it should look something like this during a semgrep-action run:
    • It should mention SEMGREP_REPO_NAME if the env variable is correctly set.
=== detecting environment
| versions          - semgrep 0.31.1 on Python 3.7.0
| environment       - running in environment git, triggering event is 'unknown'
| manage            - logged in as deployment returntocorp/semgrep#1
| policy            - using default
| SEMGREP_REPO_NAME - test_name
  • Are you correctly passing the SEMGREP_REPO_NAME env variable to the Docker environment?
    • I.e. I wouldn't expect your docker run command to work as expected without something like the following: -e 'SEMGREP_REPO_NAME=test_name'
    • I'm not familiar with BuildKite, but I see you're specifying propogate-environment: true. Is SEMGREP_REPO_NAME included in the environment key of your included image?

I suspect if we get the repo_name right it will use the correct policy.

from semgrep-action.

dlukeomalley avatar dlukeomalley commented on July 30, 2024

Thanks all! Transferring this issue to semgrep-action for discoverability in the future.

from semgrep-action.

msorens avatar msorens commented on July 30, 2024

Afterthought: probably should fail the run immediately if SEMGREP_REPO_NAME is not provided to give a clear indication of this easy-to-fall-into trap.

from semgrep-action.

dlukeomalley avatar dlukeomalley commented on July 30, 2024

@chmccreery @underyx Any thoughts on Michael's above suggestion?

from semgrep-action.

chmccreery avatar chmccreery commented on July 30, 2024

We intentionally do not require this environment variable, to make it possible to run semgrep-action in a very basic setup, without having to configure a bunch of environment variables. I would like to preserve that simplicity for users who only care about the 80% solution, and just want to run their default policy or get their rules from a local yaml file.

We could certainly print out the environment variables that are not set, as well as those that are, but this might get a bit verbose.

from semgrep-action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.