Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • dariah-de/ref-eXist
1 result
Show changes
Commits on Source (2)
test/
.gitlab-ci.yml
.git/
\ No newline at end of file
build/
expath-pkg.xml
test/
output.log
\ No newline at end of file
image: docker.gitlab.gwdg.de/mgoebel/swiss_knife/fedora:latest
# TEMPLATES
.secrets_service: &secrets_service
services:
- alias: vault
name: harbor.gwdg.de/sub-fe-pub/mgoebel/swiss_knife/fedora:latest
variables:
# pass JWT to the service container, repeat when redeclaring key 'variables'
VAULT_CI_JOB_JWT: "$CI_JOB_JWT"
.harbor-secrets: &secrets-harbor
# requires service: vault and variable VAULT_CI_JOB_JWT
- export HARBOR_TOKEN=$(wget -q -O - "http://vault:8000/?role_name=gitlab-${CI_PROJECT_PATH//\//-}&path=dariah/${CI_PROJECT_PATH/harbor&key=token")
- export HARBOR_USER=$( wget -q -O - "http://vault:8000/?role_name=gitlab-${CI_PROJECT_PATH//\//-}&path=dariah/${CI_PROJECT_PATH/harbor&key=user" )
- export HARBOR_URL=$( wget -q -O - "http://vault:8000/?role_name=gitlab-${CI_PROJECT_PATH//\//-}&path=dariah/${CI_PROJECT_PATH/harbor&key=url" )
- export HARBOR_PROJECT='sub-fe-pub'
stages:
- build
- test
- deploy
- deploy-app
- deploy-container
build-develop:
image: harbor.gwdg.de/sub-fe-pub/mgoebel/swiss_knife/fedora:latest
except:
- main
- tags
......@@ -17,6 +32,7 @@ build-develop:
- build/*.xar
build-main:
image: harbor.gwdg.de/sub-fe-pub/mgoebel/swiss_knife/fedora:latest
only:
- main
stage: build
......@@ -28,6 +44,7 @@ build-main:
- build/*.xar
test:
image: harbor.gwdg.de/sub-fe-pub/mgoebel/swiss_knife/fedora:latest
except:
- tags
stage: test
......@@ -50,14 +67,45 @@ test:
reports:
junit: test/**/tests-*.xml
upload:
stage: deploy-app
image: harbor.gwdg.de/sub-fe-pub/mgoebel/swiss_knife/fedora:latest
only:
- main
- develop
except:
- tags
stage: deploy
script:
- FILENAME=$(ls build/*.xar)
- curl -u ci:${EXIST_UPLOAD_PW} -X POST -F file=@${FILENAME} https://ci.de.dariah.eu/exist-upload
container:
stage: deploy-container
only:
- main
- develop
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
<<: *secrets_service
before_script:
- *secrets-harbor
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"${HARBOR_URL}\":{\"auth\":\"$(printf "%s:%s" ${HARBOR_USER} ${HARBOR_TOKEN} | base64 -w 0)\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor
--verbosity=info
--reproducible
--context .
--dockerfile ./Dockerfile
--build-arg build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
--build-arg vcs_ref=${CI_COMMIT_SHORT_SHA}
--target ${CI_COMMIT_BRANCH}
--destination ${IMAGE_NAME}
- printf "%s-%s" ${CI_COMMIT_BRANCH} ${CI_COMMIT_SHORT_SHA} > last-successfull-commit.txt
artifacts:
untracked: true
when: on_success
expire_in: "365 days"
paths:
- "last-successfull-commit.txt"
FROM docker.io/existdb/existdb:6.3.0
ENV PROCESSOR="6.3.0"
# for testing the local build, copy it over and comment out the corresponding ADD statement
# COPY ./build/*.xar /exist/autodeploy/
ADD https://ci.de.dariah.eu/exist-repo/find?abbrev=ref-eXist-develop&processor=${PROCESSOR} /exist/autodeploy/ref.xar
ADD https://ci.de.dariah.eu/exist-repo/find?abbrev=openapi-develop&processor=${PROCESSOR} /exist/autodeploy/openapi.xar
project.name=https://ref.dariah.eu/ref-eXist-develop
project.version=1.3.0
project.version=1.4.0
project.title=ref-eXist - GND and Getty interfaces
project.abbrev=ref-eXist-develop
project.processorversion=5.2.0
project.processorversion=6.2.0
destfile=${build.dir}/${project.abbrev}-${project.version}.xar
test.dir=test
exist.src=https://gitlab.gwdg.de/sepia/existdb-images/-/package_files/2032/download
exist.src=https://github.com/eXist-db/exist/releases/download/eXist-6.2.0/exist-distribution-6.2.0-unix.tar.bz2
......@@ -19,7 +19,7 @@
</copy>
<mkdir dir="${build.dir}"/>
<zip basedir="." destfile="${destfile}"
excludes="${build.dir}/ ${test.dir}/"/>
excludes="${build.dir}/ ${test.dir}/ .gitlab-ci.yml Dockerfile helm/ output.log .git/"/>
</target>
<target name="cleanup">
......
<?xml version="1.0" encoding="UTF-8"?>
<div xmlns="http://www.w3.org/1999/xhtml" class="templates:surround?with=templates/page.html&amp;at=content">
<h1>An error has occurred</h1>
<p>An error has been generated by the application.</p>
<pre class="error templates:error-description"/>
<div class="source-links">
<p>View source: <a href="login.html" class="templates:load-source">this page</a>.</p>
</div>
</div>
\ No newline at end of file
......@@ -2,8 +2,7 @@
<package xmlns="http://expath.org/ns/pkg"
name="https://ref.dariah.eu/ref-eXist-develop"
abbrev="ref-eXist-develop"
version="1.3.0"
version="1.4.0"
spec="1.0">
<title>ref-eXist - GND and Getty interfaces</title>
<dependency package="http://exist-db.org/apps/shared"/>
</package>
......@@ -5,5 +5,4 @@
version="@project.version@"
spec="1.0">
<title>@project.title@</title>
<dependency package="http://exist-db.org/apps/shared"/>
</package>
<?xml version="1.0" encoding="UTF-8"?>
<div xmlns="http://www.w3.org/1999/xhtml" data-template="templates:surround" data-template-with="templates/page.html" data-template-at="content">
<div class="col-md-9">
<h1 data-template="config:app-title">Generated page</h1>
<div class="alert alert-success">
<p>
<a data-template="templates:load-source" href="index.html">This</a> is the entry page into your application
and was generated by eXide. It uses HTML templates for a clean separation of HTML views and application logic.</p>
<p>To add your own template functions, start by editing the XQuery module
<a data-template="templates:load-source" href="modules/app.xql">app.xql</a>.</p>
</div>
<div class="row">
<div class="col-md-6">
<p>The page template uses the <a href="http://twitter.github.com/bootstrap/">Bootstrap</a>
CSS library for the page layout.</p>
</div>
<div class="col-md-6">
<div data-template="app:test"/>
</div>
</div>
</div>
<div class="col-md-3">
<h2>Application Info</h2>
<div data-template="config:app-info"/>
</div>
</div>
\ No newline at end of file
xquery version "3.1";
module namespace app="https://ref.dariah.eu/ref-eXist/templates";
import module namespace templates="http://exist-db.org/xquery/templates" ;
import module namespace config="https://ref.dariah.eu/ref-eXist/config" at "config.xqm";
(:~
: This is a sample templating function. It will be called by the templating module if
: it encounters an HTML element with an attribute: data-template="app:test" or class="app:test" (deprecated).
: The function has to take 2 default parameters. Additional parameters are automatically mapped to
: any matching request or function parameter.
:
: @param $node the HTML node with the attribute which triggered this call
: @param $model a map containing arbitrary data - used to pass information between template calls
:)
declare function app:test($node as node(), $model as map(*)) {
<p>Dummy template output generated by function app:test at {current-dateTime()}. The templating
function was triggered by the data-template attribute <code>data-template="app:test"</code>.</p>
};
\ No newline at end of file
xquery version "3.0";
(:~
: A set of helper functions to access the application context from
: within a module.
:)
module namespace config="https://ref.dariah.eu/ref-eXist/config";
declare namespace templates="http://exist-db.org/xquery/templates";
declare namespace repo="http://exist-db.org/xquery/repo";
declare namespace expath="http://expath.org/ns/pkg";
(:
Determine the application root collection from the current module load path.
:)
declare variable $config:app-root :=
let $rawPath := system:get-module-load-path()
let $modulePath :=
(: strip the xmldb: part :)
if (starts-with($rawPath, "xmldb:exist://")) then
if (starts-with($rawPath, "xmldb:exist://embedded-eXist-server")) then
substring($rawPath, 36)
else
substring($rawPath, 15)
else
$rawPath
return
substring-before($modulePath, "/modules")
;
declare variable $config:data-root := $config:app-root || "/data";
declare variable $config:repo-descriptor := doc(concat($config:app-root, "/repo.xml"))/repo:meta;
declare variable $config:expath-descriptor := doc(concat($config:app-root, "/expath-pkg.xml"))/expath:package;
(:~
: Resolve the given path using the current application context.
: If the app resides in the file system,
:)
declare function config:resolve($relPath as xs:string) {
if (starts-with($config:app-root, "/db")) then
doc(concat($config:app-root, "/", $relPath))
else
doc(concat("file://", $config:app-root, "/", $relPath))
};
(:~
: Returns the repo.xml descriptor for the current application.
:)
declare function config:repo-descriptor() as element(repo:meta) {
$config:repo-descriptor
};
(:~
: Returns the expath-pkg.xml descriptor for the current application.
:)
declare function config:expath-descriptor() as element(expath:package) {
$config:expath-descriptor
};
declare %templates:wrap function config:app-title($node as node(), $model as map(*)) as text() {
$config:expath-descriptor/expath:title/text()
};
declare function config:app-meta($node as node(), $model as map(*)) as element()* {
<meta xmlns="http://www.w3.org/1999/xhtml" name="description" content="{$config:repo-descriptor/repo:description/text()}"/>,
for $author in $config:repo-descriptor/repo:author
return
<meta xmlns="http://www.w3.org/1999/xhtml" name="creator" content="{$author/text()}"/>
};
(:~
: For debugging: generates a table showing all properties defined
: in the application descriptors.
:)
declare function config:app-info($node as node(), $model as map(*)) {
let $expath := config:expath-descriptor()
let $repo := config:repo-descriptor()
return
<table class="app-info">
<tr>
<td>app collection:</td>
<td>{$config:app-root}</td>
</tr>
{
for $attr in ($expath/@*, $expath/*, $repo/*)
return
<tr>
<td>{node-name($attr)}:</td>
<td>{$attr/string()}</td>
</tr>
}
<tr>
<td>Controller:</td>
<td>{ request:get-attribute("$exist:controller") }</td>
</tr>
</table>
};
\ No newline at end of file
(:~
: This is the main XQuery which will (by default) be called by controller.xql
: to process any URI ending with ".html". It receives the HTML from
: the controller and passes it to the templating system.
:)
xquery version "3.1";
import module namespace templates="http://exist-db.org/xquery/templates" ;
(:
: The following modules provide functions which will be called by the
: templating.
:)
import module namespace config="https://ref.dariah.eu/ref-eXist/config" at "config.xqm";
import module namespace app="https://ref.dariah.eu/ref-eXist/templates" at "app.xql";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method "html5";
declare option output:media-type "text/html";
let $config := map {
$templates:CONFIG_APP_ROOT : $config:app-root,
$templates:CONFIG_STOP_ON_ERROR : true()
}
(:
: We have to provide a lookup function to templates:apply to help it
: find functions in the imported application modules. The templates
: module cannot see the application modules, but the inline function
: below does see them.
:)
let $lookup := function($functionName as xs:string, $arity as xs:int) {
try {
function-lookup(xs:QName($functionName), $arity)
} catch * {
()
}
}
(:
: The HTML is passed in the request from the controller.
: Run it through the templating system and return the result.
:)
let $content := request:get-data()
return
templates:apply($content, $lookup, (), $config)
\ No newline at end of file
/* Application styles could go here */
resources/images/bgmenu.gif

2.35 KiB

resources/images/bgmenuhi.gif

2.72 KiB

resources/images/body-base.gif

203 B

resources/images/body.gif

82 B

resources/images/bold.gif

76 B

resources/images/code.gif

79 B