Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
7b13330
feat: lib classifiers (APP-84) (#35)
yaronskaya Oct 16, 2017
e215cc0
feat: add models and evaluators caching (#46)
astansler Oct 17, 2017
fea359b
chore: javascript lines to lower case
yaronskaya Oct 17, 2017
f519d3a
fix: empty email field in Repo sent to server after hashing
astansler Oct 19, 2017
e42ac71
feat: add sentry error reporting (#50)
astansler Oct 23, 2017
12a1fc9
feat: add extraction of models archive (#51)
astansler Oct 24, 2017
5346cd9
fix(longevity): StackOverflowError on serializing (APP-126) (#49)
asurkov Oct 24, 2017
3fd13a8
feat: sandbox env, bug in CodeLongevity
makrusak Oct 25, 2017
99d2cee
fix: do.sh bug
makrusak Oct 25, 2017
fc98871
feat: models compression, fix bugs in clfs (APP-121) (#52)
yaronskaya Oct 25, 2017
879dd41
wip: multiline message, remove unzipping, remove sad case (APP-129, A…
astansler Oct 30, 2017
41e2b2f
feat: move models to google cloud (APP-128) (#54)
yaronskaya Nov 2, 2017
ddd9403
feat: add c libs classifier(APP-120) (#55)
yaronskaya Nov 3, 2017
a77cd91
fix(logger): logger kills the perf (APP-137) (#56)
asurkov Nov 5, 2017
969e5a1
feat(utils): add a helper functions to measure time and record metric…
asurkov Nov 6, 2017
0d7c4b4
fix: edit invalid repo message
astansler Nov 7, 2017
f7b044a
feat: commit facts (#58)
astansler Nov 7, 2017
9844219
fix(longevity): Longevity may find extra commits (APP-142) (#60)
asurkov Nov 8, 2017
cd3c2ae
fix: correct api path in do.sh
makrusak Nov 9, 2017
2b73696
feat: update dependencies (#62)
astansler Nov 10, 2017
d12e060
feat: add result to api, check app version on server (APP-136) (#63)
astansler Nov 10, 2017
b31fa82
fix(longevity) - multiple renames are not handled properly (APP-132) …
asurkov Nov 10, 2017
85fcac9
fix: commits by author from local config not sent
astansler Nov 11, 2017
b525466
feat: invite coworkers (APP-87) (#64)
astansler Nov 13, 2017
6fde0ed
fix(invites): filtered emails being sent
astansler Nov 13, 2017
b295ef4
fix: largeobjectexception
astansler Nov 13, 2017
022a921
feat: sparse implementation of lib clfs and using protobufs (APP-122)…
yaronskaya Nov 15, 2017
22f488b
APP-141: report Longevity's crashes to Logger (#59)
asurkov Nov 17, 2017
976ffcb
wip: multiple names in imports for opencv and pb (#66)
yaronskaya Nov 17, 2017
65a41f4
wip: multiple imports for opencv and pb in python (#67)
yaronskaya Nov 20, 2017
eb72e6d
feat: new behaviour and multiple emails support (APP-145, APP-146) (#68)
astansler Nov 21, 2017
22e7b2b
fix: add new email
astansler Nov 21, 2017
3bfdce9
fix: trimmed commit diff
astansler Nov 21, 2017
bd74da9
feat: move logging level to ENV var
makrusak Nov 22, 2017
6d97e59
fix: remove ENV dependency
makrusak Nov 22, 2017
04cc200
fix: crawler bugs
astansler Nov 22, 2017
7514e87
fix: no emails message
astansler Nov 22, 2017
554ef2f
feat: temporary info log level always
makrusak Nov 22, 2017
270b188
feat: add stub kotlin extractor
astansler Nov 22, 2017
8c496aa
hotfix: dirty fixes
astansler Nov 22, 2017
66bb5ff
fix: kotlin extractor
astansler Nov 23, 2017
69efe09
feat: refactor config and files storing (APP-154) (#69)
astansler Nov 26, 2017
2557534
chore: add network error logging
astansler Nov 27, 2017
0298f93
feat: add support of Java 9 (APP-134) (#71)
astansler Nov 27, 2017
fdbe4a6
feat: add progress bar, refactor messages (APP-102) (#70)
astansler Nov 27, 2017
4907236
feat: add basic support to more langs (APP-156) (#72)
astansler Nov 27, 2017
25b64e9
fix: histogram chart
astansler Nov 27, 2017
b67f395
fix: facthasher error, gradle task for cleaning incremental data
astansler Nov 27, 2017
1c756bc
chore: remove unused import
astansler Nov 27, 2017
671de4f
feat: un-sudo installer
makrusak Nov 27, 2017
b41ed90
fix: working un-sudo
makrusak Nov 27, 2017
77fa400
chore: add copyright
astansler Nov 27, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
.DS_Store
.gradle/
.idea/
.sourcerer
build/
sourcerer-app.iml
sourcerer-app.ipr
sourcerer-app.iws
app.iml
app.ipr
app.iws
/confluence/target
/dependencies
/dist
Expand All @@ -16,4 +20,5 @@ sourcerer-app.iws
/ultimate/dependencies
/ultimate/ideaSDK
/ultimate/out
/ultimate/tmp
/ultimate/tmp
tmp_repo
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# sourcerer-app
Sourcerer hashes your git repos into intelligent engineering profiles.
<h1 align="center">
<br>
<a href="https://sourcerer.io"><img src="https://user-images.githubusercontent.com/29913247/31576516-0ce3e9ae-b105-11e7-9a8b-89f96bd44a3d.png" alt="Sourcerer" width="200"></a>
<br>
Sourcerer App
<br>
</h1>

<h3 align="center">
Sourcerer app creates an intelligent profile for software engineers.<br/>
Get early access on <a href="https://sourcerer.io">Sourcerer</a>.
</h3>
<br>

Prerequirements
=================

* Sourcerer alpha/beta access
* Linux or macOS
* Java Platform ([JRE](http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html) for Linux or [JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) for macOS)

Install/uninstall
=================

Sourcerer requires Java Platform installed on the system.
* Proceed with JRE(http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html) if on Linux,
* or with JDK(http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) if on OS X.

To install sourcerer run the following command:

```
Expand Down
62 changes: 36 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
// Copyright 2017 Sourcerer Inc. All Rights Reserved.

buildscript {
ext.kotlin_version = '1.1.4-2'
ext.kotlin_version = '1.1.51'
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.1"
classpath "org.junit.platform:junit-platform-gradle-plugin:1.0.0-RC2"
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.3"
classpath "org.junit.platform:junit-platform-gradle-plugin:1.0.1"
}
}

plugins {
id 'de.fuerstenau.buildconfig' version '1.1.8'
}



apply plugin: "idea"
apply plugin: "java"
apply plugin: "kotlin"
Expand All @@ -27,19 +25,11 @@ apply plugin: "com.google.protobuf"
apply plugin: "org.junit.platform.gradle.plugin"

buildConfig {
ext.environment = project.hasProperty('env') &&
env == 'production' ? 'prod' : 'dev'

clsName = 'BuildConfig'
packageName = 'app'

// API.
def apiBasePath = 'https://staging.eng.sourcerer.io/api/commit'
if (ext.environment == 'prod') {
apiBasePath = 'https://sourcerer.io/api/commit'
}
apiBasePath = project.hasProperty('api') ? api : apiBasePath

def apiBasePath = project.hasProperty('api') ? api : 'https://sourcerer.io/api/commit'
buildConfigField 'String', 'API_BASE_PATH', apiBasePath

// Common.
Expand All @@ -49,11 +39,21 @@ buildConfig {
buildConfigField 'int', 'VERSION_CODE', '1'
buildConfigField 'String', 'VERSION', '0.0.1'

// Logging.
buildConfigField 'String', 'LOG_LEVEL', project.hasProperty('log') ? log : 'info'

// Google Analytics.
buildConfigField 'String', 'GA_BASE_PATH', 'http://www.google-analytics.com'
buildConfigField 'String', 'GA_TRACKING_ID', 'UA-107129190-2'
buildConfigField 'boolean', 'IS_GA_ENABLED', 'true'

// Logging.
buildConfigField 'String', 'SENTRY_DSN', 'https://0263d6473bd24a9ba40e25aa5fb0a242:c5451dc815074bff8ce3fb9f0851f2f5@sentry.io/233260'
buildConfigField 'boolean', 'PRINT_STACK_TRACE', 'false'

// Models storage path.
buildConfigField 'String', 'LIBRARY_MODELS_URL', 'https://storage.googleapis.com/sourcerer-app/library-models/v1/'

buildConfig
}

Expand All @@ -65,39 +65,49 @@ junitPlatform {
}
}

task cleanData {
delete 'build/libs/data'
delete 'build/kotlin/data'
}

test.dependsOn cleanData

mainClassName = "app.MainKt"

repositories {
mavenCentral()
jcenter()
maven { url "http://dl.bintray.com/jetbrains/spek" }
flatDir {
dirs 'libs'
}
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "com.beust:jcommander:1.72"
compile 'com.google.protobuf:protobuf-java:3.0.0'
compile group: 'commons-codec', name: 'commons-codec', version: '1.5'
compile 'com.google.protobuf:protobuf-java:3.4.0'
compile 'commons-codec:commons-codec:1.5'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.9'
compile 'com.fasterxml.jackson.module:jackson-module-kotlin:2.8.9'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.8.9'
compile "io.reactivex.rxjava2:rxjava:2.1.1"
compile 'com.github.kittinunf.fuel:fuel:1.9.0'
compile 'com.github.kittinunf.fuel:fuel-rxjava:1.9.0'
compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit',
version: '4.8.0.201706111038-r'
compile "org.slf4j:slf4j-nop:1.7.2"
compile 'io.reactivex.rxjava2:rxjava:2.1.6'
compile 'com.github.kittinunf.fuel:fuel:1.11.0'
compile 'com.github.kittinunf.fuel:fuel-rxjava:1.11.0'
compile 'org.eclipse.jgit:org.eclipse.jgit:4.9.0.201710071750-r'
compile 'org.slf4j:slf4j-nop:1.7.2'
compile 'io.sentry:sentry:1.6.0'

testCompile 'org.jetbrains.kotlin:kotlin-test'
testCompile 'org.jetbrains.spek:spek-api:1.1.4'
testCompile 'org.junit.platform:junit-platform-runner:1.0.0-RC2'
testRuntime 'org.jetbrains.spek:spek-junit-platform-engine:1.1.4'
testCompile 'org.jetbrains.spek:spek-api:1.1.5'
testCompile 'org.junit.platform:junit-platform-runner:1.0.1'
testRuntime 'org.jetbrains.spek:spek-junit-platform-engine:1.1.5'
}

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.0.0"
artifact = "com.google.protobuf:protoc:3.4.0"
}
}

Expand Down
14 changes: 9 additions & 5 deletions deploy/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
podTemplate(label: 'build-pod-sourcerer-app',
containers: [
containerTemplate(name: 'jnlp', image: 'gcr.io/cloud-solutions-images/jenkins-k8s-slave', args: '${computer.jnlpmac} ${computer.name}'),
containerTemplate(name: 'jnlp', image: 'gcr.io/sourcerer-1377/jenkins-slave:v4', args: '${computer.jnlpmac} ${computer.name}'),
containerTemplate(name: 'gradle', image: 'gcr.io/sourcerer-1377/gradle:4.2.0', ttyEnabled: true, command: 'tail -f /dev/null')
],
envVars: [
Expand All @@ -12,11 +12,15 @@ podTemplate(label: 'build-pod-sourcerer-app',
]
) {
node('build-pod-sourcerer-app') {
def namespace = 'staging'
def benv = 'development'
def namespace = 'sandbox'
def plog = 'debug'

if (env.BRANCH_NAME == 'master') {
benv = 'production'
namespace = 'production'
plog = 'info'
} else if (env.BRANCH_NAME == 'develop') {
namespace = 'staging'
plog = 'info'
}

stage('checkout') {
Expand All @@ -25,7 +29,7 @@ podTemplate(label: 'build-pod-sourcerer-app',

stage('build jar and test') {
container('gradle') {
sh("ENV=${benv} ./do.sh build_jar_inside")
sh("LOG=${plog} NAMESPACE=${namespace} ./do.sh build_jar_inside")
}
}

Expand Down
1 change: 1 addition & 0 deletions deploy/production_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export REPLICAS="2"
1 change: 1 addition & 0 deletions deploy/sandbox_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export REPLICAS="1"
32 changes: 0 additions & 32 deletions deploy/sourcerer-app-staging.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ kind: Deployment
metadata:
name: sourcerer-app
spec:
replicas: 2
replicas: $REPLICAS
template:
metadata:
labels:
app: sourcerer-app
spec:
containers:
- name: sourcerer-app
image: gcr.io/sourcerer-1377/sourcerer-app:CONTAINER_TAG
image: gcr.io/sourcerer-1377/sourcerer-app:$CONTAINER_TAG
imagePullPolicy: Always
resources:
requests:
Expand Down
1 change: 1 addition & 0 deletions deploy/staging_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export REPLICAS="1"
25 changes: 19 additions & 6 deletions do.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#----- Helpers -----#
#-------------------#

set -x

usage() {
echo "$0 [COMMAND] [ARGUMENTS]"
echo " Commands:"
Expand All @@ -22,8 +24,8 @@ shift
ARGUMENTS=${@}

TAG="${CONTAINER_TAG:-latest}"
NAMESPACE="${NAMESPACE:-staging}"
ENV="${ENV:-development}"
NAMESPACE="${NAMESPACE:-sandbox}"
LOG="${LOG:-debug}"
VOLUME="${BUILD_VOLUME:-$PWD}"
PROJECT=sourcerer-app
PORT=3182
Expand All @@ -36,12 +38,22 @@ GRADLE_VERSION=4.2.0

# run only inside build container
build_jar_inside() {
gradle -Penv=$ENV build
if [ "$NAMESPACE" == "sandbox" ]; then
API="https://sandbox.eng.sourcerer.io/api/commit"
elif [ "$NAMESPACE" == "staging" ]; then
API="https://staging.eng.sourcerer.io/api/commit"
elif [ "$NAMESPACE" == "local" ]; then
API="http://localhost:3181"
else
API="https://sourcerer.io/api/commit"
fi
gradle -Plog=$LOG -Papi=$API build
}

build_jar() {
docker run -i -v $VOLUME:/home/gradle/app --workdir=/home/gradle/app -e ENV=$ENV \
gradle:$GRADLE_VERSION \
docker run -i -v $VOLUME:/home/gradle/app --workdir=/home/gradle/app \
-e LOG=$LOG -e NAMESPACE=$NAMESPACE \
gradle:$GRADLE_VERSION \
./do.sh build_jar_inside
}

Expand All @@ -50,7 +62,8 @@ build_prod_inside() {
}

deploy() {
sed "s#CONTAINER_TAG#$TAG#" ./deploy/sourcerer-app-$NAMESPACE.yaml > /tmp/deploy.yaml
source ./deploy/${NAMESPACE}_env.sh
envsubst < ./deploy/sourcerer-app.yaml > /tmp/deploy.yaml
kubectl --namespace=$NAMESPACE apply -f /tmp/deploy.yaml
}

Expand Down
29 changes: 23 additions & 6 deletions src/install/install
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ echo "Installing sourcerer app.."

SERVER=$SERVER_EXT
DOWNLOAD_URL=$SERVER/app/download
JAR_DIR=/usr/local/lib
SCRIPT_DIR=/usr/local/bin
SCRIPT_DIR=$HOME/.sourcerer
JAR_DIR=$SCRIPT_DIR

if [ -f $SCRIPT_DIR/sourcerer ] ; then
read -p "Previous version of sourcerer is detected. Reinstall it? [Y/n] " yesno < /dev/tty
Expand All @@ -16,6 +16,8 @@ if [ -f $SCRIPT_DIR/sourcerer ] ; then
fi
fi

mkdir -p $SCRIPT_DIR
mkdir -p $JAR_DIR
curl -s $DOWNLOAD_URL > $JAR_DIR/sourcerer.jar

cat <<EOF > $SCRIPT_DIR/sourcerer
Expand All @@ -27,8 +29,9 @@ if [ "\$1" = "--uninstall" ] ; then
exit
fi

rm -f /usr/local/bin/sourcerer
rm $SCRIPT_DIR/sourcerer
rm $JAR_DIR/sourcerer.jar
rm -r $JAR_DIR

echo "Done!"
exit
Expand All @@ -45,10 +48,24 @@ if ! which java > /dev/null ; then
exit 1
fi

java -jar $JAR_DIR/sourcerer.jar "\$@"
# Java 9 requires additional parameters.
version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
if [[ "$version" > "9." ]]; then # Version example for Java 9: 9.0.1
java --add-modules java.activation --add-opens java.base/java.nio=ALL-UNNAMED -jar $JAR_DIR/sourcerer.jar "\$@"
else
java -jar $JAR_DIR/sourcerer.jar "\$@"
fi
EOF

chmod +x $SCRIPT_DIR/sourcerer

echo "Done!"
echo "Run sourcerer to start hashing your repos!"

{
rm -f /usr/local/bin/sourcerer 2> /dev/null &&
ln -s $SCRIPT_DIR/sourcerer /usr/local/bin/sourcerer 2> /dev/null &&
echo "Done!" &&
echo "Run sourcerer to start hashing your repos!"
} || {
echo 'We installed app to $HOME/.sourcerer/sourcerer.'
echo 'You can add it to $PATH or ln it to /usr/local/bin'
}
Loading