Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ikone into trunk
  • Loading branch information
woltsu committed Jul 19, 2019
2 parents 196256b + c0df532 commit dd19fca
Show file tree
Hide file tree
Showing 23 changed files with 251 additions and 115 deletions.
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ before_script:
- docker --version
- docker-compose --version
- export AUTHOR_NAME="$(git log -1 ${TRAVIS_COMMIT} --pretty="%aN")"
- export SENTRY_RELEASE_VERSION=${IMAGE}-${TRAVIS_COMMIT}

jobs:
include:
Expand All @@ -26,10 +27,10 @@ jobs:
- TAG=staging
script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- source scripts.sh && time run_e2e_setup ./docker/docker-compose.lateste2e.yml ${TAG}
- source scripts.sh && time run_e2e_setup ./docker/docker-compose.lateste2e.yml ${TAG} ${SENTRY_RELEASE_VERSION}
- docker ps
- cat nginx/log
- TAG=${TAG} docker-compose -f docker-compose.yml -f ./docker/docker-compose.lateste2e.yml logs -f &
- TAG=${TAG} SENTRY_RELEASE_VERSION=${SENTRY_RELEASE_VERSION} docker-compose -f docker-compose.yml -f ./docker/docker-compose.lateste2e.yml logs -f &
- until $(curl --output /dev/null --silent --fail http://localhost:1337/); do printf '.'; sleep 5; done
- time npm run test_services
- time CYPRESS_baseUrl=http://localhost:1337/ npm run cypress:record
Expand All @@ -38,7 +39,7 @@ jobs:
deploy:
provider: script
skip_cleanup: true
script: "TAG=${TAG} docker-compose -f docker-compose.yml -f ./docker/docker-compose.lateste2e.yml push && curl -X POST -H 'Content-type: application/json' --data \"{\\\"text\\\":\\\"Staging auto deployment started!\\\"}\" ${SLACKBOT_URL}"
script: "TAG=${TAG} SENTRY_RELEASE_VERSION=${SENTRY_RELEASE_VERSION} docker-compose -f docker-compose.yml -f ./docker/docker-compose.lateste2e.yml push && curl -X POST -H 'Content-type: application/json' --data \"{\\\"text\\\":\\\"Staging auto deployment started!\\\"}\" ${SLACKBOT_URL}"
on:
branch: master
- stage: build & test & push & deploy latest
Expand All @@ -47,10 +48,10 @@ jobs:
- TAG=latest
script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- source scripts.sh && time run_e2e_setup ./docker/docker-compose.lateste2e.yml ${TAG}
- source scripts.sh && time run_e2e_setup ./docker/docker-compose.lateste2e.yml ${TAG} ${SENTRY_RELEASE_VERSION}
- docker ps
- cat nginx/log
- TAG=${TAG} docker-compose -f docker-compose.yml -f ./docker/docker-compose.lateste2e.yml logs -f &
- TAG=${TAG} SENTRY_RELEASE_VERSION=${SENTRY_RELEASE_VERSION} docker-compose -f docker-compose.yml -f ./docker/docker-compose.lateste2e.yml logs -f &
- until $(curl --output /dev/null --silent --fail http://localhost:1337/); do printf '.'; sleep 5; done
- time npm run test_services
- time CYPRESS_baseUrl=http://localhost:1337/ npm run cypress:record
Expand All @@ -59,7 +60,7 @@ jobs:
deploy:
provider: script
skip_cleanup: true
script: "TAG=${TAG} docker-compose -f docker-compose.yml -f ./docker/docker-compose.lateste2e.yml push && curl -X POST -H 'Content-type: application/json' --data \"{\\\"text\\\":\\\"${TRAVIS_TAG} release started auto deployment!\\\"}\" ${SLACKBOT_URL}"
script: "TAG=${TAG} SENTRY_RELEASE_VERSION=${SENTRY_RELEASE_VERSION} docker-compose -f docker-compose.yml -f ./docker/docker-compose.lateste2e.yml push && curl -X POST -H 'Content-type: application/json' --data \"{\\\"text\\\":\\\"${TRAVIS_TAG} release started auto deployment!\\\"}\" ${SLACKBOT_URL}"
on:
tags: true
stages:
Expand Down
5 changes: 5 additions & 0 deletions docker/docker-compose.lateste2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ services:
build:
args:
BASE_PATH: /
SENTRY_RELEASE_VERSION: ${SENTRY_RELEASE_VERSION}
SENTRY_URL: ${SENTRY_URL}
SENTRY_AUTH_TOKEN: ${SENTRY_AUTH_TOKEN}
SENTRY_ORG: sentry
SENTRY_PROJECT: oodifront
ports:
- "5000:5000"

Expand Down
7 changes: 4 additions & 3 deletions scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ echo_path () {

get_oodikone_server_backup() {
scp -r -o ProxyCommand="ssh -W %h:%p melkki.cs.helsinki.fi" oodikone.cs.helsinki.fi:/home/tkt_oodi/backups/* "$BACKUP_DIR/"
scp -r -o ProxyCommand="ssh -W %h:%p melkki.cs.helsinki.fi" svm-77.cs.helsinki.fi:/home/tkt_oodi/backups/* "$BACKUP_DIR/"
}

get_anon_oodikone() {
Expand Down Expand Up @@ -164,10 +165,10 @@ run_e2e_setup () {
echo "Getting anon backups from the private repository. "
get_anon_oodikone
echo "Building images"
TAG=$2 docker-compose -f docker-compose.yml -f $1 build
TAG=$2 SENTRY_RELEASE_VERSION=$3 docker-compose -f docker-compose.yml -f $1 build
echo "Setup oodikone db from dump."
TAG=$2 docker-compose -f docker-compose.yml -f $1 up -d db user_db db_kone
TAG=$2 SENTRY_RELEASE_VERSION=$3 docker-compose -f docker-compose.yml -f $1 up -d db user_db db_kone
db_anon_setup_full
echo "Starting services."
TAG=$2 docker-compose -f docker-compose.yml -f $1 up -d
TAG=$2 SENTRY_RELEASE_VERSION=$3 docker-compose -f docker-compose.yml -f $1 up -d
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class CourseStatsCounter {
failedMany: {},
improvedPassedGrade: {},
notParticipated: { ...allstudents },
notParticipatedOrFailed: { ...allstudents }
notParticipatedOrFailed: { ...allstudents },
markedToSemester: {}
}
this.stats = {
students: 0,
Expand Down Expand Up @@ -67,15 +68,20 @@ class CourseStatsCounter {
this.stats.passingSemesters[semester]++
}

markToSemester(studentnumber) {
this.students.markedToSemester[studentnumber] = true
}

markCredit(studentnumber, grade, passed, failed, improved, semester) {
// studentnumber = `${shajs('sha256').update(process.env.key + studentnumber).digest('hex')}`
this.markAttempt()
this.markParticipation(studentnumber)
this.markGrade(grade, passed, failed, improved)
this.markToAll(studentnumber)
if (passed) {
if (!improved && !this.students.passed[studentnumber]) {
if (!this.students.markedToSemester[studentnumber]) {
this.markPassedSemester(semester)
this.markToSemester(studentnumber)
}
this.markPassingGrade(studentnumber)
} else if (improved) {
Expand Down
7 changes: 7 additions & 0 deletions services/oodikone2-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ RUN npm ci
COPY package.json /usr/src/cache/package.json
COPY package-lock.json /usr/src/cache/package-lock.json

ARG SENTRY_RELEASE_VERSION
ENV SENTRY_RELEASE_VERSION=${SENTRY_RELEASE_VERSION}
ARG SENTRY_URL
ARG SENTRY_AUTH_TOKEN
ARG SENTRY_ORG
ARG SENTRY_PROJECT

ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
RUN if [ "${NODE_ENV}" != "production" ]; then cp -r /usr/src/app/node_modules /usr/src/cache/node_modules; fi
Expand Down
Loading

0 comments on commit dd19fca

Please sign in to comment.