Skip to content

Commit

Permalink
Add script to collect and upload lsif data from Jenkins
Browse files Browse the repository at this point in the history
Summary: TSIA. This will collect and upload lsif data for `go` and `typescript`

Test Plan: Jenkins

Reviewers: zasgar, michelle, #engineering

Reviewed By: zasgar, #engineering

Differential Revision: https://phab.corp.pixielabs.ai/D6868

GitOrigin-RevId: f6ddce9
  • Loading branch information
vihangm committed Nov 25, 2020
1 parent a8424cb commit 1e7b7ff
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ compile_commands.json
clang_tidy.log

# LSIF data for code intel
dump.lsif
*.dump.lsif
dump.lsif
25 changes: 20 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ isVizierBuildRun = env.JOB_NAME.startsWith('pixielabs-main-vizier-release-build/
isCloudStagingBuildRun = env.JOB_NAME.startsWith('pixielabs-main-cloud-staging-build/')
isCloudProdBuildRun = env.JOB_NAME.startsWith('pixielabs-main-cloud-release-build/')

runCoverageJob = isMainRun

// Currently disabling TSAN on BPF builds because it runs too slow.
// In particular, the uprobe deployment takes far too long. See issue:
// https://pixie-labs.atlassian.net/browse/PL-1329
Expand Down Expand Up @@ -721,18 +719,35 @@ preBuild['Process Dependencies'] = {
}
}

// Only run coverage on main test.
if (runCoverageJob) {
if (isMainRun) {
// Only run coverage on main runs.
builders['Build & Test (gcc:coverage)'] = {
WithSourceCodeAndTargetsK8s('coverage') {
container('pxbuild') {
warnError('Bazel command failed') {
warnError('Coverage command failed') {
sh "scripts/collect_coverage.sh -u -t ${CODECOV_TOKEN} -b main -c `cat GIT_COMMIT`"
}
createBazelStash('build-gcc-coverage-testlogs')
}
}
}

// Only run LSIF on main runs.
builders['LSIF (sourcegraph)'] = {
WithSourceCodeAndTargetsK8s('lsif') {
container('pxbuild') {
warnError('LSIF command failed') {
withCredentials([
string(
credentialsId: 'sourcegraph-api-token',
variable: 'SOURCEGRAPH_TOKEN')
]) {
sh "scripts/collect_and_upload_lsif.sh -t ${SOURCEGRAPH_TOKEN} -c `cat GIT_COMMIT`"
}
}
}
}
}
}

builders['Lint & Docs'] = {
Expand Down
72 changes: 72 additions & 0 deletions scripts/collect_and_upload_lsif.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash -ex

SOURCEGRAPH_ENDPOINT="https://cs.corp.pixielabs.ai"

GIT_COMMIT=""
SOURCEGRAPH_ACCESS_TOKEN=""

# Print out the usage information and exit.
usage() {
echo "Usage $0 [-t <sourcegraph_token>] [-c <git_commit>]" 1>&2;
exit 1;
}

parse_args() {
local OPTIND
# Process the command line arguments.
while getopts "c:t:h" opt; do
case ${opt} in
c)
GIT_COMMIT=$OPTARG
;;
t)
SOURCEGRAPH_ACCESS_TOKEN=$OPTARG
;;
:)
echo "Invalid option: $OPTARG requires an argument" 1>&2
;;
h)
usage
;;
*)
usage
;;
esac
done
shift $((OPTIND -1))
}

# Parse the input arguments.
parse_args "$@"

export SRC_ENDPOINT="${SOURCEGRAPH_ENDPOINT}"
export SRC_ACCESS_TOKEN="${SOURCEGRAPH_ACCESS_TOKEN}"

pushd "$(bazel info workspace)"

LSIF_GO_OUT="go.dump.lsif"

/opt/pixielabs/bin/lsif-go \
--verbose \
--no-animation \
--output="${LSIF_GO_OUT}"

/opt/pixielabs/bin/src lsif upload \
-repo=github.com/pixie-labs/pixielabs \
-file="${LSIF_GO_OUT}" \
-commit="${GIT_COMMIT}" \
-ignore-upload-failure \
-no-progress

LSIF_TS_OUT="ts.dump.lsif"

lsif-tsc --out "${LSIF_TS_OUT}" -p src/ui

/opt/pixielabs/bin/src lsif upload \
-repo=github.com/pixie-labs/pixielabs \
-file="${LSIF_TS_OUT}" \
-commit="${GIT_COMMIT}" \
-ignore-upload-failure \
-no-progress

popd

0 comments on commit 1e7b7ff

Please sign in to comment.