Skip to content
Snippets Groups Projects
Commit a4d07507 authored by iaibrys's avatar iaibrys
Browse files

Refactor build info, refactor dtu-core configuration

parent 7f0244d3
Branches
Tags
No related merge requests found
Pipeline #109 failed
...@@ -20,14 +20,17 @@ before_script: ...@@ -20,14 +20,17 @@ before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
test: test:
image: $CONTAINER_TEST_IMAGE
services:
- name: lab.compute.dtu.dk:5005/enote/dtu-quiz-db
alias: db
tags: tags:
- enote-shell - enote-docker
stage: test stage: test
script: script:
- echo "Running tests" - echo "Running tests"
- echo docker run $CONTAINER_TEST_IMAGE ./scripts/run-tests.sh - echo ./scripts/run-tests.sh
- docker pull $CONTAINER_TEST_IMAGE - ./scripts/run-tests.sh
- docker run $CONTAINER_TEST_IMAGE ./scripts/run-tests.sh
build: build:
tags: tags:
......
...@@ -43,18 +43,7 @@ module DTUCourseWebsite ...@@ -43,18 +43,7 @@ module DTUCourseWebsite
config.autoload_paths += Dir["#{config.root}/app/responders/**/"] config.autoload_paths += Dir["#{config.root}/app/responders/**/"]
config.autoload_paths += Dir["#{config.root}/lib**/"] config.autoload_paths += Dir["#{config.root}/lib**/"]
config.dtu_data = { root_path: ENV.fetch('DTU_DATA_ROOT') { '/data' }, DtuCore::app_init config
filemanager_path: ENV.fetch('DTU_FILEMANAGER'){ '/filemanager' },
redis: ENV.fetch('DTU_REDIS_URL') { 'redis' },
source: 'core' }
# TODO
config.environment = {
public_facing?: true, #(elicit_portal[:host].include?('compute.dtu.dk') || false),
##external_host: "#{elicit_portal[:host]}",
#external_hostname: "#{elicit_portal[:scheme]}://#{elicit_portal[:host] + port}",
#external_protocol: elicit_portal[:scheme]
}
# allow precompile in dockerfile (i.e. when DB may not be available) # allow precompile in dockerfile (i.e. when DB may not be available)
# http://stackoverflow.com/questions/8997226/rake-assetsprecompile-attempting-to-connect-to-database # http://stackoverflow.com/questions/8997226/rake-assetsprecompile-attempting-to-connect-to-database
...@@ -65,9 +54,10 @@ module DTUCourseWebsite ...@@ -65,9 +54,10 @@ module DTUCourseWebsite
g.test_framework :rspec g.test_framework :rspec
end end
logger = ActiveSupport::Logger.new(STDOUT) log_level = String(ENV.fetch('LOG_LEVEL') { config.deployment_environment[:public_facing] ? 'info' : 'debug' }).upcase
logger.formatter = config.log_formatter config.logger = Logger.new(STDOUT)
config.logger = ActiveSupport::TaggedLogging.new(logger) config.logger.level = Logger.const_get(log_level)
config.log_level = log_level
config.lograge.enabled = true config.lograge.enabled = true
# log rage doesn't log params by default, so add this to do so. # log rage doesn't log params by default, so add this to do so.
......
dtu-enote-website:
version: 3.533
build_date: 2019-03-07T16:55:35-0800
branch: "develop"
commit: "7f0244d3128afedcc5cb628631a5d8b75740cf2b"
origin_url: git@lab.compute.dtu.dk:enote/dtu-enote-website
commit_details: 2019-03-04 7f0244d (HEAD -> develop, origin/develop) Iain Bryson -- Cleanup scripts and move precompile to dockerfile
recent_commit_details:
- "2019-03-04 7f0244d (HEAD -> develop, origin/develop) Iain Bryson -- Cleanup scripts and move precompile to dockerfile"
- "2019-03-04 5df4103 Iain Bryson -- Merge branch '202-admin-feedback-doesn-t-refresh-when-deleting-saving-feedback' into 'develop'"
- "2019-03-04 94ece4f (202-admin-feedback-doesn-t-refresh-when-deleting-saving-feedback) Iain Bryson -- Make feedback reponse write-once."
- "2019-02-28 7b2ce82 Iain Bryson -- Package updates & fix double publish"
- "2019-02-22 e32e8e8 Iain Bryson -- stop docker containers"
- "2019-02-22 49b3f2a Iain Bryson -- Try raw docker compose functions for deploy"
- "2019-02-22 d31804a Iain Bryson -- Remove debugging statements; another try at deploy."
- "2019-02-22 cd0f46d Iain Bryson -- fix deployment"
- "2019-02-22 9899ddc Iain Bryson -- Clean up dead or exited containers before deploy"
...@@ -49,7 +49,7 @@ Rails.application.configure do ...@@ -49,7 +49,7 @@ Rails.application.configure do
# Use the lowest log level to ensure availability of diagnostic information # Use the lowest log level to ensure availability of diagnostic information
# when problems arise. # when problems arise.
config.log_level = config.environment[:public_facing?] ? :info : :debug config.log_level = config.deployment_environment[:public_facing] ? :info : :debug
# Prepend all log lines with the following tags. # Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ] # config.log_tags = [ :subdomain, :uuid ]
......
Subproject commit 8d16eb97433beb07d9c4f6531bfedfc9b6cd3717 Subproject commit 7c287b95548d0a3fc38aad0e7da26807f3d90643
feedbackjs @ 94935d91
Subproject commit 94935d912a44a588a6b699d924d05d5feac8fcf6
#!/bin/bash
function get_version() {
current_branch=$(git branch | grep \* | cut -d ' ' -f2)
branches=(master develop $current_branch)
for branch_idx in "${!branches[@]}"; do
[[ "${branches[$branch_idx]}" = "${current_branch}" ]] && break
done
version=""
# echo $branch_idx
while (( branch_idx >= 1 )); do
# echo "${branches[branch_idx]} ^${branches[branch_idx - 1]}"
commit_distance=$(git log --oneline ${branches[branch_idx]} ^${branches[branch_idx - 1]} | wc -l)
version=".${commit_distance// /}${version}"
(( branch_idx-- ))
done
master_commit=$(git log master --pretty=oneline | wc -l)
full_version="${master_commit}${version}"
echo ${full_version}
}
function emit_info() {
component_name=$1
component_dir=$2
#ISO 8601
builddate=`date "+%Y-%m-%dT%H:%M:%S%z"`
echo "${component_name}:"
branch=`git --git-dir=$component_dir/.git --work-tree=$PWD/$component_dir rev-parse --abbrev-ref HEAD`
echo " version: $(get_version)"
echo " build_date: ${builddate}"
echo " branch: \"${branch}\""
commit=`git --git-dir=$component_dir/.git --work-tree=$PWD/$component_dir rev-parse HEAD`
echo " commit: \"${commit}\""
origin_url=`git --git-dir=$component_dir/.git --work-tree=$PWD/$component_dir remote show origin | grep Fetch | sed 's/ Fetch URL: //g'`
echo " origin_url: ${origin_url}"
commit_details=`git --git-dir=$component_dir/.git --work-tree=$PWD/$component_dir log --pretty=format:'%ad %h %d %cn -- %s' --abbrev-commit --date=short -1 | sed 's/\: /; /g'`
commit_details_clean=$(echo "${commit_details}" | sed s/\"/''/g | sed 's/:/;/g' )
echo " commit_details: ${commit_details_clean}"
echo " recent_commit_details: "
git --git-dir=$component_dir/.git --work-tree=$PWD/$component_dir log --pretty=format:'%ad %h %d %cn -- %s' --abbrev-commit --date=short -10 | while read recent_commit_detail; do
line=$(echo $recent_commit_detail | sed s/\"/''/g | sed 's/:/;/g' )
echo " - \"${line}\""
done
}
component=$(git config --local remote.origin.url | gsed -r 's/.*[:/]([^/]+)(\.git)?$/\1/' | gsed -r 's/\//-/')
emit_info ${component} .
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment