Skip to content

Commit 7753ae9

Browse files
Merge pull request #52 from VolkerHartmann/docker4metastore
Merge changes from branch docker-metastore to development.
2 parents b18eb68 + 864c3c3 commit 7753ae9

10 files changed

+178
-27
lines changed

.github/workflows/docker-publish.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Create and publish a Docker image on github
2+
name: Create and publish a Docker image
3+
4+
# Configures this workflow to run every time a change
5+
# is tagged with a '-v' in between (e.g.: metastore-v1.0.0).
6+
on:
7+
push:
8+
# Publish `main` as Docker `latest` image.
9+
# branches:
10+
# - main
11+
12+
# Publish `v1.2.3` tags as releases.
13+
tags:
14+
# - v*
15+
- '*-v*'
16+
17+
# Defines two custom environment variables for the workflow.
18+
# These are used for the Container registry domain, and a
19+
# name for the Docker image that this workflow builds.
20+
env:
21+
REGISTRY: ghcr.io
22+
IMAGE_NAME: ${{ github.repository }}
23+
24+
# Two jobs for creating and pushing Docker image
25+
# - build-and-push-image -> triggered by commits on main and tagging with semantic version (e.g.: v1.2.3)
26+
# - build-and-push-image-of-branch -> triggered by tags matching '*-v*' (e.g.: Version_1-v1.2.3)
27+
jobs:
28+
build-and-push-image:
29+
runs-on: ubuntu-latest
30+
if: ${{ contains(github.ref_name, '-') == failure() }}
31+
# Sets the permissions granted to the `GITHUB_TOKEN`
32+
# for the actions in this job.
33+
permissions:
34+
contents: read
35+
packages: write
36+
#
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
# Uses the `docker/login-action` action to log in to the Container
41+
# registry using the account and password that will publish the packages.
42+
# Once published, the packages are scoped to the account defined here.
43+
- name: Log in to the Container registry
44+
uses: docker/login-action@v3
45+
with:
46+
registry: ${{ env.REGISTRY }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about)
50+
# to extract tags and labels that will be applied to the specified image.
51+
# The `id` "meta" allows the output of this step to be referenced in a
52+
# subsequent step. The `images` value provides the base name for the tags
53+
# and labels.
54+
- name: Extract metadata (tags, labels) for Docker
55+
id: meta
56+
uses: docker/metadata-action@v5
57+
with:
58+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
59+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
60+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
61+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
62+
- name: Build and push Docker image
63+
uses: docker/build-push-action@v5
64+
with:
65+
context: .
66+
push: true
67+
tags: ${{ steps.meta.outputs.tags }}
68+
labels: ${{ steps.meta.outputs.labels }}
69+
build-and-push-image-of-branch:
70+
runs-on: ubuntu-latest
71+
if: contains(github.ref_name, '-')
72+
# Sets the permissions granted to the `GITHUB_TOKEN`
73+
# for the actions in this job.
74+
permissions:
75+
contents: read
76+
packages: write
77+
#
78+
steps:
79+
- name: Split first part
80+
env:
81+
TAG: ${{ github.ref_name }}
82+
id: split
83+
run: echo "branch=${TAG%-v*}" >> $GITHUB_OUTPUT
84+
- name: Test variable
85+
run: |
86+
echo ${{ steps.split.outputs.branch }}
87+
- name: Checkout repository
88+
uses: actions/checkout@v4
89+
# Uses the `docker/login-action` action to log in to the Container
90+
# registry using the account and password that will publish the packages.
91+
# Once published, the packages are scoped to the account defined here.
92+
- name: Log in to the Container registry
93+
uses: docker/login-action@v3
94+
with:
95+
registry: ${{ env.REGISTRY }}
96+
username: ${{ github.actor }}
97+
password: ${{ secrets.GITHUB_TOKEN }}
98+
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about)
99+
# to extract tags and labels that will be applied to the specified image.
100+
# The `id` "meta" allows the output of this step to be referenced in a
101+
# subsequent step. The `images` value provides the base name for the tags
102+
# and labels.
103+
- name: Extract metadata (tags, labels) for Docker
104+
id: meta-branch
105+
uses: docker/metadata-action@v5
106+
with:
107+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{steps.split.outputs.branch}}
108+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
109+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
110+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
111+
- name: Build and push Docker image
112+
uses: docker/build-push-action@v5
113+
with:
114+
context: .
115+
push: true
116+
tags: ${{ steps.meta-branch.outputs.tags }}
117+
labels: ${{ steps.meta-branch.outputs.labels }}
118+

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM httpd:2.4
2+
COPY . /usr/local/apache2/htdocs/
3+

definitions/metastore/landingpage_schema.handlebars

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,27 @@
7373
<div class="ui fluid list" style="margin-left: 10px">
7474
<div class="item">
7575
<div class="content">
76-
<div class="header">
77-
<a href='{{md_record.metadataDocumentUri}}' target='_blank'>Download Metadata</a></div>
76+
<div class="header">Metadata Document</div>
77+
<div id="download_json" class="ui vertical animated button" tabindex="0">
78+
<div class="hidden content">Save</div>
79+
<div class="visible content">
80+
<i class="download icon"></i>
81+
</div>
82+
</div>
7883
<div class="description">{{md_record.documentHash}}</div>
7984
</div>
8085
</div>
8186
</div>
8287
<div class="ui fluid list" style="margin-left: 10px">
8388
<div class="item">
8489
<div class="content">
85-
<div class="header">
86-
<a href='{{schema_record.schemaDocumentUri}}' target='_blank'>Download Schema</a></div>
90+
<div class="header">Schema Document</div>
91+
<div id="download_schema" class="ui vertical animated button" tabindex="1">
92+
<div class="hidden content">Save</div>
93+
<div class="visible content">
94+
<i class="download icon"></i>
95+
</div>
96+
</div>
8797
<div class="description">{{schema_record.schemaHash}}</div>
8898
</div>
8999
</div>

definitions/metastore/landingpage_schema.handlebars.js

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

elastic-search-metastore.html

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<script src="js/semantic-ui/dropdown.min.js"></script>
2222
<script src="https://cdn.jsdelivr.net/npm/keycloak-js@18.0.1/dist/keycloak.min.js"></script>
2323
<script src="./js/download.js"></script>
24+
<script src="js/apply-config.js"></script>
2425

2526
<link rel="stylesheet" href="./css/styles.css"/>
2627

@@ -311,6 +312,16 @@ <h1 class="ui block header">
311312
let from = 0;
312313
let size = page_size;
313314

315+
applyConfig(keycloak, showServiceUrl,appDescription, config, addMessage, (login, username) => {
316+
if(login){
317+
$("#logged_in_as").text("Logged in as " + username);
318+
$("#editor-create-button").removeAttr("disabled");
319+
}else{
320+
$("#logged_in_as").text("Not logged in.");
321+
$("#editor-create-button").attr("disabled", "disabled");
322+
}
323+
});
324+
314325
Handlebars.registerHelper('isOpen', function (list) {
315326
if (list != null && list.indexOf("anonymousUser") > -1) {
316327
return true;
@@ -438,6 +449,15 @@ <h1 class="ui block header">
438449
from = from + size;
439450
doSearch(true);
440451
});
452+
453+
if (localStorage.getItem("userLoggedIn")) {
454+
localStorage.removeItem("userLoggedIn")
455+
$("#login_button").click();
456+
}
457+
458+
if (typeof keycloak != typeof undefined && config.token == null) {
459+
$("#editor-create-button").attr("disabled", "disabled");
460+
}
441461
addMessage(0, "Search successfully initialized.");
442462

443463

@@ -794,14 +814,14 @@ <h1 class="ui block header">
794814

795815
$.ajax({
796816
type: "GET",
797-
url: ajaxBaseUrl + "metadata/" + id,
817+
url: ajaxBaseUrl + id,
798818
contentType: "application/json",
799819
headers: headers,
800820
success: function (output, status, xhr) {
801821
resolve(output);
802822
},
803823
error: function (result) {
804-
let message = "Failed to obtain metadata " + ajaxBaseUrl + "metadata/" + id + ". (HTTP " + result.status + ")";
824+
let message = "Failed to obtain metadata " + ajaxBaseUrl + id + ". (HTTP " + result.status + ")";
805825
reject(message);
806826
}
807827
});

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
33
<html>
44
<head>
5-
<meta http-equiv="refresh" content="0; url='dashboard.html'"/>
5+
<meta http-equiv="refresh" content="0; url='./schema-management.html'"/>
66
</head>
77
<body/>
88
</html>

js/metastore-utils.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ export function readSchema(schemaUrl) {
5656
let message = "Failed to read schema from URL " + schemaUrl + ". (HTTP " + result.status + ")";
5757
reject(message);
5858
}
59-
});
59+
})
6060
});
61-
}
62-
61+
};
6362

6463
export function readSchemaIds() {
6564
let headers = {

0 commit comments

Comments
 (0)