Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
courses
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
R3
school
courses
Commits
6160e914
Commit
6160e914
authored
4 years ago
by
Laurent Heirendt
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into 'master'
Regular merge of develop Closes
#7
See merge request
!80
parents
fc3e45c3
ec9522d0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!83
Add matomo
,
!80
Regular merge of develop
Pipeline
#29313
passed
4 years ago
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.ci/deploy.sh
+10
-51
10 additions, 51 deletions
.ci/deploy.sh
.ci/generateIndex.py
+71
-0
71 additions, 0 deletions
.ci/generateIndex.py
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
.gitlab-ci.yml
+74
-5
74 additions, 5 deletions
.gitlab-ci.yml
with
157 additions
and
56 deletions
.ci/deploy.sh
+
10
−
51
View file @
6160e914
#!/bin/bash
PAGEURL
=
"https://
r3.pages.uni.lu/school/courses
"
PAGEURL
=
"https://
courses.lcsb.uni.lu
"
rootDir
=
$(
pwd
)
echo
$rootDir
...
...
@@ -9,11 +9,13 @@ echo $rootDir
rm
-rf
$rootDir
/public
mkdir
$rootDir
/public
# create img folders
mkdir
$rootDir
/public/img
mkdir
$rootDir
/public/img/unstable
mkdir
$rootDir
/public/img/latest
mkdir
$rootDir
/public/img/stable
if
[[
$CI_COMMIT_BRANCH
==
"develop"
]]
;
then
version
=
"latest"
;
elif
[[
$CI_COMMIT_BRANCH
==
"master"
]]
;
then
version
=
"stable"
;
else
version
=
"unstable"
;
fi
# loop through all the presentations
nBlades
=
0
...
...
@@ -26,16 +28,12 @@ do
do
if
[[
${#
d1
}
-ge
2
]]
;
then
let
"nBlades+=1"
#blades[$nBlades]="$tutorial"
BLADE
=
${
d1
:2
}
echo
" > -----------------------------------------------------"
echo
"Building ...
${
d1
}
"
# create the required folders in public
mkdir
$rootDir
/public/
$BLADE
mkdir
$rootDir
/public/
$BLADE
/unstable
mkdir
$rootDir
/public/
$BLADE
/latest
mkdir
$rootDir
/public/
$BLADE
/stable
mkdir
-p
$rootDir
/public/
$BLADE
/
$version
# change to the blade directory to be built
cd
$BLADE
...
...
@@ -50,50 +48,11 @@ do
ln
-s
../../theme theme
# install npm
#npm install -g npm@latest yo grunt-cli generator-reveal
#npm install
yarn global add grunt-cli generator-reveal
yarn
install
grunt dist
mv
public/
*
$rootDir
/public/
$BLADE
/unstable/.
# link to the img directory
mv
$rootDir
/public/
$BLADE
/unstable/slides/img/
*
$rootDir
/public/img/unstable/.
rm
-rf
$rootDir
/public/
$BLADE
/unstable/slides/img
ln
-s
../../../img/unstable
$rootDir
/public/
$BLADE
/unstable/slides/img
echo
" > unstable built for file set
${
BLADE
}
"
# build the master version into stable
git fetch
--tags
latestTag
=
$(
git describe
--tags
`
git rev-list
--tags
--max-count
=
1
`
)
git stash
git checkout
$latestTag
git submodule update
--init
grunt dist
mv
public/
*
$rootDir
/public/
$BLADE
/stable/.
# link to the img directory
mv
$rootDir
/public/
$BLADE
/stable/slides/img/
*
$rootDir
/public/img/stable/.
rm
-rf
$rootDir
/public/
$BLADE
/stable/slides/img
ln
-s
../../../img/stable
$rootDir
/public/
$BLADE
/stable/slides/img
echo
" > stable built for file set
${
BLADE
}
"
# build the develop version into latest
git stash
git checkout
-f
develop
git fetch origin develop
git reset
--hard
origin/develop
git submodule update
--init
grunt dist
mv
public/
*
$rootDir
/public/
$BLADE
/latest/.
# link to the img directory
mv
$rootDir
/public/
$BLADE
/latest/slides/img/
*
$rootDir
/public/img/latest/.
rm
-rf
$rootDir
/public/
$BLADE
/latest/slides/img
ln
-s
../../../img/latest
$rootDir
/public/
$BLADE
/latest/slides/img
mv
public/
*
$rootDir
/public/
$BLADE
/
$version
/.
echo
" > latest built for file set
${
BLADE
}
"
...
...
This diff is collapsed.
Click to expand it.
.ci/generateIndex.py
0 → 100644
+
71
−
0
View file @
6160e914
import
os
,
re
from
os
import
path
def
build_link
(
title
,
href
):
return
f
'
- <a href=
"
{
href
}
"
>
{
title
}
</a>
\n
'
def
build_section_start
(
title
):
return
f
'
\n
'
#<h3>{title}</h3>\n
def
build_section_end
():
return
""
#\t\t</ul>\n\t</div>
def
camel_to_snake
(
name
):
name
=
re
.
sub
(
'
(.)([A-Z][a-z]+)
'
,
r
'
\1_\2
'
,
name
)
return
re
.
sub
(
'
([a-z0-9])([A-Z])
'
,
r
'
\1_\2
'
,
name
).
lower
()
# loop through the entire internal tree
localroot
=
os
.
getcwd
()
# generate the index properly speaking
cardDirs
=
[
"
2020
"
,
"
2019
"
]
index
=
''
# determine first the directories
for
direct
in
cardDirs
:
if
path
.
isdir
(
direct
):
dirs
=
os
.
listdir
(
direct
)
dirs
.
sort
(
reverse
=
True
);
index
+=
"
\n
#
"
+
direct
+
"
\n\n
"
for
d
in
dirs
:
if
d
[
0
]
!=
"
.
"
:
href
=
'
https://courses.lcsb.uni.lu/
'
+
d
linkText
=
camel_to_snake
(
d
)
linkText
=
linkText
.
replace
(
"
_
"
,
"
"
)
linkText
=
linkText
.
title
()
# special rules
linkText
=
linkText
.
replace
(
"
Dm
"
,
"
Data Management
"
)
linkText
=
linkText
.
replace
(
"
It
"
,
"
IT
"
)
linkText
=
linkText
.
replace
(
"
Siu
"
,
"
SIU
"
)
index
+=
build_link
(
linkText
,
href
)
# output the index
print
(
index
)
# Read in the file
repoName
=
"
courses.lcsb.uni.lu
"
os
.
chdir
(
repoName
)
indexFile
=
"
index.md
"
filedata
=
""
with
open
(
indexFile
,
'
r
'
)
as
file
:
for
line
in
file
:
filedata
+=
line
# stop reading once the index place holder has been reached
if
re
.
search
(
"
<!-- index -->
"
,
line
):
filedata
+=
"
[[ index ]]
"
break
# Replace the target string
filedata
=
filedata
.
replace
(
'
[[ index ]]
'
,
index
)
# Write the file out again
with
open
(
indexFile
,
'
w
'
)
as
file
:
file
.
write
(
filedata
)
print
(
"
\n
> New index generated and saved in
"
+
indexFile
)
os
.
chdir
(
"
..
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
.gitignore
+
2
−
0
View file @
6160e914
site/
courses.lcsb.uni.lu
index.html
package-lock.json
dist/
...
...
This diff is collapsed.
Click to expand it.
.gitlab-ci.yml
+
74
−
5
View file @
6160e914
image
:
git-r3lab.uni.lu:4567/r3/docker/nodejs-yarn-grunt
stages
:
-
retrieve
-
generate
-
build
-
deploy
pages
:
stage
:
deploy
retrieve:repo
:
image
:
name
:
alpine/git:latest
entrypoint
:
[
"
"
]
stage
:
retrieve
script
:
-
bash .ci/deploy.sh
-
'
git
clone
https://git-r3lab.uni.lu/R3/school/courses.lcsb.uni.lu.git
courses.lcsb.uni.lu'
artifacts
:
expire_in
:
1 day
paths
:
-
courses.lcsb.uni.lu
generate:index
:
image
:
python
stage
:
generate
rules
:
-
if
:
$CI_COMMIT_BRANCH == "develop"
script
:
-
python .ci/generateIndex.py
artifacts
:
expire_in
:
1 day
paths
:
-
courses.lcsb.uni.lu
build:website
:
image
:
git-r3lab.uni.lu:4567/r3/docker/jekyll-lcsb
stage
:
build
before_script
:
-
cd courses.lcsb.uni.lu
-
gem install bundler -v2.0.2
-
bundle install && bundle update jekyll-theme-lcsb-default && bundle update jekyll-theme-lcsb-frozen-components
-
cd ..
script
:
-
cd courses.lcsb.uni.lu
-
bundle exec jekyll build -d site --config "_config.yml"
-
mv site ../.
-
cd ..
artifacts
:
expire_in
:
1 week
expire_in
:
1 day
paths
:
-
site
variables
:
JEKYLL_ENV
:
production
build:courses
:
image
:
git-r3lab.uni.lu:4567/r3/docker/nodejs-yarn-grunt
stage
:
build
rules
:
-
if
:
$CI_COMMIT_BRANCH == "develop"
before_script
:
-
git submodule update --recursive --init
script
:
-
bash .ci/deploy.sh
artifacts
:
expire_in
:
1 day
paths
:
-
public
upload
:
stage
:
deploy
image
:
alpine
before_script
:
-
'
which
ssh-agent
||
(
apk
add
--update
openssh
)'
-
eval $(ssh-agent -s)
-
echo "$B64SSHPRIVKEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
-
mkdir -p ~/.ssh && chmod 700 ~/.ssh
-
'
echo
-e
"Host
*\n\tStrictHostKeyChecking
no\n\n"
>
~/.ssh/config'
-
echo "$KNOWNHOSTS" > ~/.ssh/known_hosts
-
chmod 644 ~/.ssh/known_hosts
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"develop"'
script
:
-
scp -P $SSHPORT -r site/* $SSHCONNECT:~/web/latest
-
scp -P $SSHPORT -r public/* $SSHCONNECT:~/web/latest
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment