Skip to content

Commit 99a49fb

Browse files
author
Dave Bartolomeo
committed
Move packs to codeql org
1 parent 6a1e814 commit 99a49fb

File tree

10 files changed

+184
-18
lines changed

10 files changed

+184
-18
lines changed

BUILD.bazel

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
load("//misc/bazel:pkg.bzl", "codeql_pack")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
[
6+
codeql_pack(
7+
name = "-".join(parts),
8+
srcs = [
9+
"//actions/extractor",
10+
],
11+
pack_prefix = "/".join(parts),
12+
)
13+
for parts in (
14+
[
15+
"experimental",
16+
"actions",
17+
],
18+
["actions"],
19+
)
20+
]

extractor/BUILD.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
load("//misc/bazel:pkg.bzl", "codeql_pkg_files", "strip_prefix")
2+
3+
codeql_pkg_files(
4+
name = "extractor",
5+
srcs = [
6+
"codeql-extractor.yml",
7+
] + glob(["tools/**"]),
8+
strip_prefix = strip_prefix.from_pkg(),
9+
visibility = ["//actions:__pkg__"],
10+
)

extractor/codeql-extractor.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "actions"
2+
aliases: []
3+
display_name: "GitHub Actions"
4+
version: 0.0.1
5+
column_kind: "utf16"
6+
unicode_newlines: true
7+
build_modes:
8+
- none
9+
file_coverage_languages: []
10+
github_api_languages: []
11+
scc_languages: []
12+
file_types:
13+
- name: workflow
14+
display_name: GitHub Actions workflow files
15+
extensions:
16+
- .yml
17+
- .yaml
18+
forwarded_extractor_name: javascript
19+
options:
20+
trap:
21+
title: TRAP options
22+
description: Options about how the extractor handles TRAP files
23+
type: object
24+
visibility: 3
25+
properties:
26+
cache:
27+
title: TRAP cache options
28+
description: Options about how the extractor handles its TRAP cache
29+
type: object
30+
properties:
31+
dir:
32+
title: TRAP cache directory
33+
description: The directory of the TRAP cache to use
34+
type: string
35+
bound:
36+
title: TRAP cache bound
37+
description: A soft limit (in MB) on the size of the TRAP cache
38+
type: string
39+
pattern: "[0-9]+"
40+
write:
41+
title: TRAP cache writeable
42+
description: Whether to write to the TRAP cache as well as reading it
43+
type: string
44+
pattern: "(true|TRUE|false|FALSE)"

extractor/tools/autobuild-impl.ps1

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
if (($null -ne $env:LGTM_INDEX_INCLUDE) -or ($null -ne $env:LGTM_INDEX_EXCLUDE) -or ($null -ne $env:LGTM_INDEX_FILTERS)) {
2+
Write-Output 'Path filters set. Passing them through to the JavaScript extractor.'
3+
} else {
4+
Write-Output 'No path filters set. Using the default filters.'
5+
$DefaultPathFilters = @(
6+
'exclude:**/*',
7+
'include:.github/workflows/**/*.yml',
8+
'include:.github/workflows/**/*.yaml',
9+
'include:**/action.yml',
10+
'include:**/action.yaml'
11+
)
12+
13+
$env:LGTM_INDEX_FILTERS = $DefaultPathFilters -join "`n"
14+
}
15+
16+
# Find the JavaScript extractor directory via `codeql resolve extractor`.
17+
$CodeQL = Join-Path $env:CODEQL_DIST 'codeql.exe'
18+
$env:CODEQL_EXTRACTOR_JAVASCRIPT_ROOT = &$CodeQL resolve extractor --language javascript
19+
if ($LASTEXITCODE -ne 0) {
20+
throw 'Failed to resolve JavaScript extractor.'
21+
}
22+
23+
Write-Output "Found JavaScript extractor at '${env:CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}'."
24+
25+
# Run the JavaScript autobuilder.
26+
$JavaScriptAutoBuild = Join-Path $env:CODEQL_EXTRACTOR_JAVASCRIPT_ROOT 'tools\autobuild.cmd'
27+
Write-Output "Running JavaScript autobuilder at '${JavaScriptAutoBuild}'."
28+
29+
# Copy the values of the Actions extractor environment variables to the JavaScript extractor environment variables.
30+
$env:CODEQL_EXTRACTOR_JAVASCRIPT_DIAGNOSTIC_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_DIAGNOSTIC_DIR
31+
$env:CODEQL_EXTRACTOR_JAVASCRIPT_LOG_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_LOG_DIR
32+
$env:CODEQL_EXTRACTOR_JAVASCRIPT_SCRATCH_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_SCRATCH_DIR
33+
$env:CODEQL_EXTRACTOR_JAVASCRIPT_SOURCE_ARCHIVE_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_SOURCE_ARCHIVE_DIR
34+
$env:CODEQL_EXTRACTOR_JAVASCRIPT_TRAP_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_TRAP_DIR
35+
$env:CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE = $env:CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE
36+
37+
&$JavaScriptAutoBuild
38+
if ($LASTEXITCODE -ne 0) {
39+
throw "JavaScript autobuilder failed."
40+
}

extractor/tools/autobuild.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
rem All of the work is done in the PowerShell script
3+
powershell.exe %~dp0autobuild-impl.ps1

extractor/tools/autobuild.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
DEFAULT_PATH_FILTERS=$(cat << END
6+
exclude:**/*
7+
include:.github/workflows/**/*.yml
8+
include:.github/workflows/**/*.yaml
9+
include:**/action.yml
10+
include:**/action.yaml
11+
END
12+
)
13+
14+
if [ -n "${LGTM_INDEX_INCLUDE:-}" ] || [ -n "${LGTM_INDEX_EXCLUDE:-}" ] || [ -n "${LGTM_INDEX_FILTERS:-}" ] ; then
15+
echo "Path filters set. Passing them through to the JavaScript extractor."
16+
else
17+
echo "No path filters set. Using the default filters."
18+
LGTM_INDEX_FILTERS="${DEFAULT_PATH_FILTERS}"
19+
export LGTM_INDEX_FILTERS
20+
fi
21+
22+
# Find the JavaScript extractor directory via `codeql resolve extractor`.
23+
CODEQL_EXTRACTOR_JAVASCRIPT_ROOT="$($CODEQL_DIST/codeql resolve extractor --language javascript)"
24+
export CODEQL_EXTRACTOR_JAVASCRIPT_ROOT
25+
26+
echo "Found JavaScript extractor at '${CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}'."
27+
28+
# Run the JavaScript autobuilder
29+
JAVASCRIPT_AUTO_BUILD="${CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}/tools/autobuild.sh"
30+
echo "Running JavaScript autobuilder at '${JAVASCRIPT_AUTO_BUILD}'."
31+
32+
# Copy the values of the Actions extractor environment variables to the JavaScript extractor environment variables.
33+
env CODEQL_EXTRACTOR_JAVASCRIPT_DIAGNOSTIC_DIR="${CODEQL_EXTRACTOR_ACTIONS_DIAGNOSTIC_DIR}" \
34+
CODEQL_EXTRACTOR_JAVASCRIPT_LOG_DIR="${CODEQL_EXTRACTOR_ACTIONS_LOG_DIR}" \
35+
CODEQL_EXTRACTOR_JAVASCRIPT_SCRATCH_DIR="${CODEQL_EXTRACTOR_ACTIONS_SCRATCH_DIR}" \
36+
CODEQL_EXTRACTOR_JAVASCRIPT_SOURCE_ARCHIVE_DIR="${CODEQL_EXTRACTOR_ACTIONS_SOURCE_ARCHIVE_DIR}" \
37+
CODEQL_EXTRACTOR_JAVASCRIPT_TRAP_DIR="${CODEQL_EXTRACTOR_ACTIONS_TRAP_DIR}" \
38+
CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE="${CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE}" \
39+
${JAVASCRIPT_AUTO_BUILD}

ql/lib/qlpack.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
library: true
33
warnOnImplicitThis: true
4-
name: github/actions-all
4+
name: codeql/actions-all
55
version: 0.1.85
66
dependencies:
77
codeql/util: ^1.0.1
88
codeql/yaml: ^1.0.1
99
codeql/controlflow: ^1.0.1
1010
codeql/dataflow: ^1.0.1
11-
extractor: javascript
12-
dbscheme: semmlecode.javascript.dbscheme
13-
groups: javascript
11+
codeql/javascript-all: ^2.0.2
12+
extractor: actions
13+
groups: actions
1414
dataExtensions:
1515
- ext/manual/*.model.yml
1616
- ext/generated/**/*.model.yml

ql/src/codeql-pack.lock.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,25 @@
22
lockVersion: 1.0.0
33
dependencies:
44
codeql/controlflow:
5-
version: 1.0.1
5+
version: 1.0.10
66
codeql/dataflow:
7-
version: 1.0.1
7+
version: 1.1.4
8+
codeql/javascript-all:
9+
version: 2.0.2
10+
codeql/mad:
11+
version: 1.0.10
12+
codeql/regex:
13+
version: 1.0.10
814
codeql/ssa:
9-
version: 1.0.1
15+
version: 1.0.10
16+
codeql/tutorial:
17+
version: 1.0.10
1018
codeql/typetracking:
11-
version: 1.0.1
19+
version: 1.0.10
1220
codeql/util:
13-
version: 1.0.1
21+
version: 1.0.10
22+
codeql/xml:
23+
version: 1.0.10
1424
codeql/yaml:
15-
version: 1.0.1
25+
version: 1.0.10
1626
compiled: false

ql/src/qlpack.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
library: false
3-
name: github/actions-queries
3+
name: codeql/actions-queries
44
version: 0.1.85
55
groups: [actions, queries]
66
suites: codeql-suites
7-
extractor: javascript
7+
extractor: actions
88
defaultSuiteFile: codeql-suites/actions-code-scanning.qls
99
dependencies:
10-
github/actions-all: ${workspace}
10+
codeql/actions-all: ${workspace}
1111
warnOnImplicitThis: true

ql/test/qlpack.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
name: github/actions-tests
3-
groups: [javascript, test]
2+
name: codeql/actions-tests
3+
groups: [codeql, test]
44
dependencies:
5-
github/actions-all: ${workspace}
6-
github/actions-queries: ${workspace}
7-
extractor: javascript
5+
codeql/actions-all: ${workspace}
6+
codeql/actions-queries: ${workspace}
7+
extractor: actions
88
tests: .
99
warnOnImplicitThis: true
1010

0 commit comments

Comments
 (0)