1
0
mirror of synced 2025-12-21 10:57:10 -05:00
Files
docs/content/github/finding-security-vulnerabilities-and-errors-in-your-code/running-codeql-code-scanning-in-a-container.md
Octomerger Bot 87fb2ceae2 repo sync (#16715)
* Improve documentation issue no #1034

Done with the minor fixes for open issue number #1034 .

* Increasing the importance

I wanted to delete a branch, but I couldn't in spite of reading this document. The problem was, the branch I wanted to delete was the default branch. 
Even though it is stated in this document, it was not given enough importance that everyone would see it.

* typo

A small type in the comments

* Update setting-up-your-development-environment-to-create-a-github-app.md

Fix two small typos.

* properly capitalize "macOS"

* Clarify GH password requirements

* Change " to `

As done in the description of `master`

* " to ` in DE

* " to ` in PT

* " to ` in RU

* Fix typo metadata-syntax-for-github-actions.md

Fix typo for metadata-syntax-for-github-actions#outputs-for-composite-run-steps-actions

* chore: Remove bolding from headings

* Removed deprecated echo set-env instruction

* fix typo (#1516)

Co-authored-by: hubwriter <hubwriter@github.com>

* Remove extraneous grammar period which breaks the compare URL (#1252)

* Remove extraneous grammar period which breaks the compare URL

* Update data/reusables/repositories/two-dot-diff-comparison-example-urls.md

Co-authored-by: Nick Schonning <nschonni@gmail.com>

Co-authored-by: Nick Schonning <nschonni@gmail.com>
Co-authored-by: hubwriter <hubwriter@github.com>

* Revert "" to ` in RU"

This reverts commit d484fd6ef5.

* Revert "" to ` in PT"

This reverts commit fab62f05be.

* Revert "" to ` in DE"

This reverts commit 78abcd6f7a.

* Change md

This squashes all the translation commits and their deletion.

* Update content/github/collaborating-with-issues-and-pull-requests/creating-and-deleting-branches-within-your-repository.md

Co-authored-by: Felicity Chapman <felicitymay@github.com>

Co-authored-by: Atharva Shirdhankar <72031540+StarTrooper08@users.noreply.github.com>
Co-authored-by: Aakarsh B <aakarshbiju@gmail.com>
Co-authored-by: Aritra Roy Gosthipaty <aritra.born2fly@gmail.com>
Co-authored-by: Guilherme Macedo <guilherme@gmacedo.com>
Co-authored-by: Stephen Wade <stephen@stephenwade.me>
Co-authored-by: Shao Yang Hong <hongsy2006@gmail.com>
Co-authored-by: a2br <62328077+a2br@users.noreply.github.com>
Co-authored-by: Cas van Dinter <casvd@hotmail.com>
Co-authored-by: Nick Schonning <nschonni@gmail.com>
Co-authored-by: Antoine Rondelet <rondelet.antoine@gmail.com>
Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
Co-authored-by: Meg Bird <megbird@github.com>
Co-authored-by: ねず <39144575+wonda-tea-coffee@users.noreply.github.com>
Co-authored-by: hubwriter <hubwriter@github.com>
Co-authored-by: Ilia <ilia@wearebond.com>
Co-authored-by: a2br <a2br@users.noreply.github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Jason Etcovitch <jasonetco@github.com>
2020-12-02 16:03:35 +00:00

3.7 KiB

title, shortTitle, intro, product, versions
title shortTitle intro product versions
Running CodeQL code scanning in a container {% data variables.product.prodname_code_scanning_capc %} in a container You can run {% data variables.product.prodname_code_scanning %} in a container by ensuring that all processes run in the same container. {% data reusables.gated-features.code-scanning %}
free-pro-team enterprise-server
* >=2.22

{% data reusables.code-scanning.beta %}

About {% data variables.product.prodname_code_scanning %} with a containerized build

If you're setting up {% data variables.product.prodname_code_scanning %} for a compiled language, and you're building the code in a containerized environment, the analysis may fail with the error message "No source code was seen during the build." This indicates that {% data variables.product.prodname_codeql %} was unable to monitor your code as it was compiled.

You must run {% data variables.product.prodname_codeql %} in the same container in which you build your code. This applies whether you are using the {% data variables.product.prodname_codeql_runner %}, or {% data variables.product.prodname_actions %}. If you're using the {% data variables.product.prodname_codeql_runner %}, run it in the container where your code builds. For more information about the {% data variables.product.prodname_codeql_runner %}, see "Running {% data variables.product.prodname_codeql %} in your CI system." If you're using {% data variables.product.prodname_actions %}, configure your workflow to run all the actions in the same container. For more information, see "Example workflow."

Dependencies

You may have difficulty running {% data variables.product.prodname_code_scanning %} if the container you're using is missing certain dependencies (for example, Git must be installed and added to the PATH variable). If you encounter dependency issues, review the list of software typically included on {% data variables.product.prodname_dotcom %}'s virtual environments. For more information, see the version-specific readme files in these locations:

Example workflow

This sample workflow uses {% data variables.product.prodname_actions %} to run {% data variables.product.prodname_codeql %} analysis in a containerized environment. The value of container.image identifies the container to use. In this example the image is named codeql-container, with a tag of f0f91db. For more information, see "Workflow syntax for {% data variables.product.prodname_actions %}."

name: "{% data variables.product.prodname_codeql %}"

on: 
  push:
    branches: [main]
  pull_request:
    branches: [main]
  schedule:
    - cron: '0 0 * * 0'

jobs:
  analyze:
    name: Analyze
    runs-on: ubuntu-latest 

    strategy:
      fail-fast: false
      matrix:
        language: [java]

    # Specify the container in which actions will run
    container:
      image: codeql-container:f0f91db

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
    - name: Initialize {% data variables.product.prodname_codeql %}
      uses: github/codeql-action/init@v1
      with:
        languages: {% raw %}${{ matrix.language }}{% endraw %}
    - name: Build
      run: |
        ./configure
        make
    - name: Perform {% data variables.product.prodname_codeql %} Analysis
      uses: github/codeql-action/analyze@v1