Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KOB-32302] [KOB-32266] Implement antora build portal help documentation and resolve conflict #27

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
6bf4f31
Implement portal-help documentation to embed the portal web application
huyvankobiton Dec 19, 2022
e30846e
Implement portal-help documentation to embed the portal web application
huyvankobiton Dec 19, 2022
6224294
Update build and deployment
huyvankobiton Dec 20, 2022
57328a5
Merge branch 'KOB-32302-32266-Implement-portal-help-documenation' of …
huyvankobiton Dec 20, 2022
e7ef60e
Update file on the docker folder to build docker images
huyvankobiton Dec 20, 2022
a5be377
add Dockerfile
phonght15 Dec 22, 2022
c12d726
yarn install and yarn build
phonght15 Dec 22, 2022
4381818
update dokerfile
phonght15 Dec 22, 2022
b04a84f
update Dockerfile
phonght15 Dec 22, 2022
27de070
update
phonght15 Dec 22, 2022
2211aee
add build.sh
phonght15 Dec 22, 2022
b4018af
add dockerize.sh
phonght15 Dec 22, 2022
46850e3
update dockerize
phonght15 Dec 22, 2022
f962c77
update dockerize
phonght15 Dec 22, 2022
eda168c
update dockerize
phonght15 Dec 22, 2022
e124664
update dockerize
phonght15 Dec 22, 2022
9ee61cf
update
phonght15 Dec 22, 2022
1a66304
update
phonght15 Dec 22, 2022
c46d432
update
phonght15 Dec 22, 2022
0b1e516
update
phonght15 Dec 22, 2022
1478fd5
update
phonght15 Dec 22, 2022
6f0f01e
Update dockerize.sh
phongho15 Dec 22, 2022
5dd4be9
Update dockerize.sh
phongho15 Dec 22, 2022
1538542
Update dockerize.sh
phongho15 Dec 22, 2022
5b17c05
Update dockerize.sh
phongho15 Dec 22, 2022
a19ef3b
Update dockerize.sh
phongho15 Dec 23, 2022
7194c8e
Update dockerize.sh
phongho15 Dec 23, 2022
6053054
Update dockerize.sh
phongho15 Dec 23, 2022
9fcf7cc
Update dockerize.sh
phongho15 Dec 23, 2022
36f8f13
Update Dockerfile
phongho15 Dec 23, 2022
2744110
Update Dockerfile
phongho15 Dec 23, 2022
d42d417
Update Dockerfile
phongho15 Dec 23, 2022
7bcc627
Update Dockerfile
phongho15 Dec 23, 2022
2f2e02b
Update dockerize.sh
phongho15 Dec 23, 2022
78eabd6
Update Dockerfile
phongho15 Dec 23, 2022
93ab0f1
Update Dockerfile
phongho15 Dec 23, 2022
a100003
Update dockerize.sh
phongho15 Dec 23, 2022
cfbf3b1
Merge branch 'main' into KOB-32302-32266-Implement-antora-build-porta…
huyvankobiton Dec 27, 2022
e20d525
resolve conflict and update xref
huyvankobiton Dec 27, 2022
26bf0eb
Change docker build and add jenkins file
huyvankobiton Dec 28, 2022
1ed1586
change style portal help
Jun 7, 2023
7371d0e
Merge branch 'main' into KOB-32302-32266-Implement-antora-build-porta…
Jun 7, 2023
3cc07ab
change style and fix search config
Jun 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
pipeline {
options {
disableConcurrentBuilds()
}

agent {
label "nodejs-app-slave-3"
}

parameters {
string(name: 'COMMIT_ID', defaultValue: '', description: "The git commit id to indicate the codebase for building. By default it's the environment GIT_COMMIT from Jenkins.")
booleanParam(name: 'BUILD', defaultValue: true, description: "Build and publish Docker image to AWS ECR.")
booleanParam(name: 'CI_TO_KOBITON_TEST', defaultValue: true, description: 'Deploy to Kobiton Test environment')
// booleanParam(name: 'CI_TO_KOBITON_STAGING', defaultValue: false, description: 'Deploy to Kobiton Staging environment')
// booleanParam(name: "CI_TO_KOBITON_PRODUCTION", defaultValue: false, description: "Deploy an existing build to Kobiton Production environment")
booleanParam(name: "APPLY_K8S_VIRTUAL_SERVICE_MANIFEST", defaultValue: true, description: "apply K8s Virtual Service manifest, which will affect traffic switching")
string(name: 'DEPLOY_REPO_CODEBASE_ID', defaultValue: '', description: 'Either the remote branch ("origin/<branch name>"), git commit id ("aaec22") or git tag (release-v3.6.0) of the env repo that is used to deploy the app. By default it is "origin/master"')

}

environment {
CI_DEPLOY_APP_NAME = "documentation"
CI_DOCKER_IMAGE_NAME = "documentation"
REPO_NAME = "kobiton/documentation"
}

stages {
stage('Set CI variables') {

steps {
script {
GIT_COMMIT_ID=sh(script: "[ -z $params.COMMIT_ID ] && echo ${env.GIT_COMMIT.take(6)} || git rev-parse --short=6 $params.COMMIT_ID", returnStdout: true).trim()
}
}
}
stage('Pull docker-ci tool') {

steps {
script {
// login to AWS ECR
sh('eval $(aws ecr get-login --no-include-email --region ap-southeast-1)')

sh("docker pull 580359070243.dkr.ecr.ap-southeast-1.amazonaws.com/docker-ci:latest")

// Alias it to call below statement
sh("docker tag 580359070243.dkr.ecr.ap-southeast-1.amazonaws.com/docker-ci:latest docker-ci:latest")
}
}
}

stage('Build and publish to AWS ECR') {

steps {
script {
sh("docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
docker-ci:latest \
--git-url $env.GIT_URL \
--commit-id $GIT_COMMIT_ID \
build --docker --docker-centralized --docker-image-name portal-help \
--docker-image-tag $GIT_COMMIT_ID")
sh("docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
docker-ci:latest \
--git-url $env.GIT_URL \
--commit-id $GIT_COMMIT_ID \
build --docker --docker-centralized --docker-image-name documentation \
--docker-image-tag $GIT_COMMIT_ID")
sh("docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
docker-ci:latest archive --docker-registry \
--docker-image-name portal-help \
--docker-image-tag $GIT_COMMIT_ID")
sh("docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
docker-ci:latest archive --docker-registry \
--docker-image-name documentation \
--docker-image-tag $GIT_COMMIT_ID")
}
}
}

stage("Deploy to Kobiton Test") {
when {
expression {
// Allow to skip deploy the branch master to Test server in case manual
return !env.BRANCH_NAME.startsWith("PR-") && params.CI_TO_KOBITON_TEST
}
}

steps {
script {
sh("docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
docker-ci:latest deploy \
--env-name kobiton-test --app-name documentation \
${params.APPLY_K8S_VIRTUAL_SERVICE_MANIFEST? "--extra-k8s-apply-virtual-service" : ''} \
${params.DEPLOY_REPO_CODEBASE_ID ? "--env-codebase-id $params.DEPLOY_REPO_CODEBASE_ID" : ''} \
--docker-image-tag $GIT_COMMIT_ID")
}
}
}
}

post {
failure {
script {
sh("docker run --rm \
docker-ci:latest notify \
--failure \
--job-param-name COMMIT_ID --job-param-value ${GIT_COMMIT_ID} \
--job-param-name CI_TO_KOBITON_TEST --job-param-value ${params.CI_TO_KOBITON_TEST} \
--job-param-name CI_TO_KOBITON_STAGING --job-param-value ${params.CI_TO_KOBITON_STAGING} \
--job-param-name CI_TO_KOBITON_PRODUCTION --job-param-value ${params.CI_TO_KOBITON_PRODUCTION} \
--job-param-name CI_TO_ML_INTEGRATION --job-param-value ${params.CI_TO_ML_INTEGRATION} \
--job-param-name APPLY_K8S_VIRTUAL_SERVICE_MANIFEST --job-param-value ${params.APPLY_K8S_VIRTUAL_SERVICE_MANIFEST} \
${params.DEPLOY_REPO_CODEBASE_ID ? "--job-param-name DEPLOY_REPO_CODEBASE_ID --job-param-value $params.DEPLOY_REPO_CODEBASE_ID": ''} \
--ci-job-url ${env.BUILD_URL} \
--ci-job-id ${env.BUILD_ID} \
--git-repo-name $env.REPO_NAME")
}
}

success {
script {
sh("docker run --rm \
docker-ci:latest notify \
--job-param-name BUILD --job-param-value ${params.BUILD} \
--job-param-name COMMIT_ID --job-param-value ${GIT_COMMIT_ID} \
--job-param-name CI_TO_KOBITON_TEST --job-param-value ${params.CI_TO_KOBITON_TEST} \
--job-param-name CI_TO_KOBITON_STAGING --job-param-value ${params.CI_TO_KOBITON_STAGING} \
--job-param-name CI_TO_KOBITON_PRODUCTION --job-param-value ${params.CI_TO_KOBITON_PRODUCTION} \
--job-param-name CI_TO_ML_INTEGRATION --job-param-value ${params.CI_TO_ML_INTEGRATION} \
--job-param-name APPLY_K8S_VIRTUAL_SERVICE_MANIFEST --job-param-value ${params.APPLY_K8S_VIRTUAL_SERVICE_MANIFEST} \
${params.DEPLOY_REPO_CODEBASE_ID ? "--job-param-name DEPLOY_REPO_CODEBASE_ID --job-param-value $params.DEPLOY_REPO_CODEBASE_ID": ''} \
--ci-job-url ${env.BUILD_URL} \
--ci-job-id ${env.BUILD_ID} \
--git-repo-name $env.REPO_NAME")
}
}
}
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Documentation
Kobiton Help Documentation

### Setup development
- `node` exact version: >=16.x
- Install `yarn` v1.22.4 or newer

### Other commands

```
yarn install
yarn build
```

### Build docker image
- To build docker documentation: `docker build -t kobiton/documentation:1.0 -f docker/documentation/Dockerfile .`
- To build docker portal-help:`docker build -t kobiton/portal-help:1.0 -f docker/portal-help/Dockerfile .`
29 changes: 29 additions & 0 deletions antora-playbook-portal-help.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
site:
title: Kobiton Documentation

content:
sources:
- url: .
start_paths: docs
branches: HEAD

asciidoc:
attributes:
standalone-only: false
cloud-only: true

antora:
extensions:
- require: '@antora/lunr-extension'
index_latest_only: true
- require: '@sntke/antora-mermaid-extension'
mermaid_library_url: https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js
script_stem: header-scripts
mermaid_initialize_options: { startOnLoad: true }
ui:
bundle:
url: ui-bundle-portal-help
snapshot: true
supplemental_files: './ui-bundle-portal-help/supplemental_ui'
output:
dir: ./build/portal-help
4 changes: 3 additions & 1 deletion antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ antora:
- require: '@sntke/antora-mermaid-extension'
mermaid_library_url: https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js
script_stem: header-scripts
mermaid_initialize_options: "{ startOnLoad: true }"
mermaid_initialize_options: { startOnLoad: true }
ui:
bundle:
url: ui-bundle
snapshot: true
supplemental_files: './ui-bundle/supplemental_ui'
output:
dir: ./build/documentation
15 changes: 15 additions & 0 deletions docker/documentation/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM nginx:1.12.2-alpine

RUN mkdir -p /documentation
WORKDIR /documentation

COPY docker/documentation/nginx.conf /etc/nginx
COPY docker/mime.types /etc/nginx

COPY build/documentation .

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]


65 changes: 65 additions & 0 deletions docker/documentation/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#
# The nginx configuration controls the serving of static web assets
# for Portal Web UI. Since it's deployed in iP OP (running at customer side),
# please keep that in mind for any change you're going to make here
#
worker_processes 1;

# We need to see when error occurs
error_log /dev/stderr info;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

server {
listen 80;
root /documentation;

# Optimize for serving static asset
# https://docs.nginx.com/nginx/admin-guide/web-server/serving-static-content/
sendfile on;
sendfile_max_chunk 1m;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10s;

expires 1M;

location / {
charset utf-8;
index index.html index.htm;
try_files $uri /index.html;
}

location ~* \.(?:js|json)$ {
access_log off;

# The size of .js files are around 10MB so they should be compressed
# to reduce the time of loading Web UI. Files are cached (by "expires")
# so we don't need to apply compression for all files which takes more
# computing
gzip on;
gzip_comp_level 4;
gzip_types *;
}

location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz)$ {
access_log off;
}

location ~* \.(?:woff|woff2|ttf||otf)$ {
access_log off;
types {
font/truetype ttf;
font/opentype otf;
application/font-woff woff;
application/font-woff2 woff2;
}
}
}
}
89 changes: 89 additions & 0 deletions docker/mime.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;

text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;

image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;

application/font-woff woff;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;

application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;

application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;

audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;

video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}
13 changes: 13 additions & 0 deletions docker/portal-help/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM nginx:1.12.2-alpine

RUN mkdir -p /portal-help
WORKDIR /portal-help

COPY docker/portal-help/nginx.conf /etc/nginx
COPY docker/mime.types /etc/nginx

COPY build/portal-help .

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
Loading