Commit 4a1f6021 authored by Matija Obreza's avatar Matija Obreza
Browse files

Releases: Updated CI

parent ec551c28
include:
# https://docs.gitlab.com/ce/ci/yaml/README.html#workflowrules-templates
- template: 'Workflows/Branch-Pipelines.gitlab-ci.yml'
variables:
DOCKER_HOST: "genesys1.swarm.genesys-pgr.org"
IMAGE_VERSION: "0.1"
IMAGE_VERSION: "2021.1"
UI_EXPRESS_ARTIFACT: "workspaces/ui-express/target/app"
UI_EXPRESS_IMAGE_NAME: "gg-ce-web"
stages:
- package
- dockerize
- tag
# - deploy
.package_template: &node_package
......@@ -51,34 +56,75 @@ build workspaces:
- cp -r ${UI_EXPRESS_ARTIFACT} workspaces/ui-express/docker
- cd workspaces/ui-express/docker
- export REGISTRY_IMAGE="${CI_REGISTRY_IMAGE}/${UI_EXPRESS_IMAGE_NAME}"
- if [ "${CI_COMMIT_REF_SLUG}" = "master" ] ; then
export IMAGE_TAG="${IMAGE_VERSION}";
export IMAGE_EXTRA="latest";
- if [ "${CI_COMMIT_REF_SLUG}" = "${CI_DEFAULT_BRANCH}" ] ; then
export IMAGE_TAG="${VERSION}-edge";
else
export IMAGE_TAG="${IMAGE_VERSION}-${CI_COMMIT_REF_SLUG}";
if echo "${CI_COMMIT_TAG}" | grep -Eq 'v\d+.*'; then
export IMAGE_TAG=${CI_COMMIT_TAG:1};
else
export IMAGE_TAG="${CI_COMMIT_REF_SLUG}";
fi
fi
- "echo Building ${REGISTRY_IMAGE}:${IMAGE_TAG} extra=${IMAGE_EXTRA}"
- ${DOCKER_CMD} build -t ${REGISTRY_IMAGE}:${IMAGE_TAG} .
- echo "$CI_JOB_TOKEN" | ${DOCKER_CMD} login -u gitlab-ci-token $CI_REGISTRY --password-stdin
- if [ "${IMAGE_EXTRA}" != "" ]; then ${DOCKER_CMD} tag ${REGISTRY_IMAGE}:${IMAGE_TAG} ${REGISTRY_IMAGE}:${IMAGE_EXTRA}; ${DOCKER_CMD} push ${REGISTRY_IMAGE}:${IMAGE_EXTRA}; fi
- "echo Building image: ${REGISTRY_IMAGE}:${IMAGE_TAG}"
- DOCKER_BUILDKIT=1 ${DOCKER_CMD} build -t ${REGISTRY_IMAGE}:${IMAGE_TAG} .
- ${DOCKER_CMD} login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- ${DOCKER_CMD} push ${REGISTRY_IMAGE}:${IMAGE_TAG}
- ${DOCKER_CMD} logout $CI_REGISTRY
dockerize ggceweb master or tag:
<<: *docker_image_ggceweb
stage: dockerize
dependencies:
- build workspaces
only:
- master
- tags
dockerize ggceweb branch:
dockerize gg-ce-web:
<<: *docker_image_ggceweb
stage: dockerize
dependencies:
- build workspaces
when: manual
except:
- master
- tags
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- if: '$CI_COMMIT_TAG'
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
when: manual
allow_failure: true
.docker_setup: &docker_setup
before_script:
- echo Tagging latest image ${CI_REGISTRY_IMAGE}:{VERSION}
- TLS_PATH=~/.docker/${DOCKER_HOST}/certs && mkdir -p ${TLS_PATH}
- echo "${DOCKER_TLS_CA}" > ${TLS_PATH}/ca.pem
- echo "${DOCKER_TLS_KEY}" > ${TLS_PATH}/key.pem
- echo "${DOCKER_TLS_CERT}" > ${TLS_PATH}/cert.pem
- export DOCKER_CERT_PATH=${TLS_PATH}
- DOCKER_CMD="docker --tlsverify=false"
tag latest gg-ce-web image:
stage: tag
image: docker:${DOCKER_VERSION}
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+.*/'
when: manual
allow_failure: true
<<: *docker_setup
script:
- export REGISTRY_IMAGE="${CI_REGISTRY_IMAGE}/${UI_EXPRESS_IMAGE_NAME}"
- "echo Tagging: ${REGISTRY_IMAGE}:${VERSION} as ${REGISTRY_IMAGE}:latest"
- ${DOCKER_CMD} login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- ${DOCKER_CMD} pull ${CI_REGISTRY_IMAGE}:${VERSION}
- ${DOCKER_CMD} tag ${REGISTRY_IMAGE}:${VERSION} ${REGISTRY_IMAGE}:latest
- ${DOCKER_CMD} push ${REGISTRY_IMAGE}:latest
- ${DOCKER_CMD} logout $CI_REGISTRY
tag edge gg-ce-web image:
stage: tag
image: docker:${DOCKER_VERSION}
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: always
allow_failure: true
<<: *docker_setup
script:
- export REGISTRY_IMAGE="${CI_REGISTRY_IMAGE}/${UI_EXPRESS_IMAGE_NAME}"
- "echo Tagging: ${REGISTRY_IMAGE}:edge"
- ${DOCKER_CMD} login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- ${DOCKER_CMD} pull ${CI_REGISTRY_IMAGE}:${VERSION}-edge
- ${DOCKER_CMD} tag ${REGISTRY_IMAGE}:${VERSION}-edge ${REGISTRY_IMAGE}:edge
- ${DOCKER_CMD} push ${REGISTRY_IMAGE}:edge
- ${DOCKER_CMD} logout $CI_REGISTRY
......@@ -5,29 +5,46 @@ The **GRIN-Global Client** is a set of tools for genebank
technicians, curators and managers to interact with the
[GG-CE Server](https://gitlab.croptrust.org/grin-global/grin-global-server) APIs.
Please check https://gitlab.croptrust.org/grin-global/grin-global-ui/-/releases for
information on new releases!
# Running GG-CE Web
**GG-CE Web** is available as a Docker image `dockerhub.croptrust.org/grin-global/grin-global-ui/gg-ce-web:latest`. This allows for easy management and updating to newer versions.
**GG-CE Web** is available as a Docker image `dockerhub.croptrust.org/grin-global/grin-global-ui/gg-ce-web:2021.1`.
The preview of the next version is available as `dockerhub.croptrust.org/grin-global/grin-global-ui/gg-ce-web:2021.2-edge` and
you should update your copy of the image before **restarting** your container:
```bash
docker image pull dockerhub.croptrust.org/grin-global/grin-global-ui/gg-ce-web:2021.2-edge
```
**Note:** You can also just run the current *development* version using the `:edge` tag:
```bash
docker image pull dockerhub.croptrust.org/grin-global/grin-global-ui/gg-ce-web:edge
```
The **GG-CE Web** container requires a few configuration options. The options
are provided as environment variables. You need to note:
1. `API_URL`: The URL to the **GG-CE Server** (e.g. `http://GGCE-SERVER:8081`)
1. `ORIGIN`: The frontend URL of the **GG-CE Web** service (e.g. `http://GGCE-WEB:3000`)
1. `CLIENT_ID` and `CLIENT_SECRET`: OAuth Client credentials (or skip to use default values)
1. `API_URL`: The URL to the **GG-CE Server** (e.g. `http://GGCE-SERVER:8081`)
This should match the host name (including port, if not default) where *gg-ce-server* is accessible.
1. `ORIGIN`: The frontend URL of the **GG-CE Web** service (e.g. `http://GGCE-WEB:3000`)
This should match the `FRONTEND_URL` variable of your *gg-ce-server* container when using the default OAuth client.
You can omit this if using a OAuth client you declared manually.
1. `CLIENT_ID` and `CLIENT_SECRET`: OAuth Client credentials (or skip to use default values)
OAuth client credentials of **gg-ce-web**.
Start **GG-CE Server** as a Docker container:
```bash
# Pull latest image
docker image pull dockerhub.croptrust.org/grin-global/grin-global-ui/gg-ce-web:latest
# Start GG-CE Web
docker run --rm --name 'ggce-web' \
-p 3000:3000 \
-e "API_URL=http://GGCE-SERVER:8081" \
-e "ORIGIN=http://GGCE-WEB:3000" \
dockerhub.croptrust.org/grin-global/grin-global-ui/gg-ce-web:latest
dockerhub.croptrust.org/grin-global/grin-global-ui/gg-ce-web:2021.1
```
**Note:** After hitting **Enter** You should immediately seeing log messages on the console. If not, then your command is not valid. Hit `Ctrl + C` and retry.
......@@ -69,7 +86,7 @@ Application config {
# Development environment
`node >=10.4.1` and `yarn >=1.21.1` are required. See below for installation
`node >=14.16.0` and `yarn >=1.21.1` are required. See below for installation
instructions.
Run `yarn install` in the project root directory.
......
{
"name": "grin-global-ui",
"version": "0.1.0",
"version": "2021.1",
"private": true,
"license": "Apache-2.0",
"homepage": "https://gitlab.croptrust.org/grin-global/grin-global-ui",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment