Commit e452751b by Daniele Venzano

Modify gitlab CI and manifest

parent b1d0a9ac
Pipeline #4503 passed with stages
in 1 minute 10 seconds
stages:
- build
- test
- push
- pull
- deploy
variables:
VERSION: $CI_BUILD_ID
VERSION: $CI_PIPELINE_ID
images:
image: docker:latest
stage: deploy
before_script:
- mkdir -p /etc/docker/certs.d/$DOCKER_REGISTRY
- cp /registry-ca.crt /etc/docker/certs.d/$DOCKER_REGISTRY/ca.crt
- mkdir -p $HOME/.docker
- echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
- apk update
- apk add python findutils bash
image: docker:latest
before_script:
- mkdir -p /etc/docker/certs.d/$DOCKER_REGISTRY
- cp /registry-ca.crt /etc/docker/certs.d/$DOCKER_REGISTRY/ca.crt
- mkdir -p $HOME/.docker
- echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
build:boinc:
stage: build
script:
- docker build -t ${DOCKER_REGISTRY}/${REPOSITORY}/boinc:${VERSION} docker/boinc
build:json:
image: python:3-alpine
stage: build
script:
- bash build_all.sh
- python gen_json.py
- bash validate_all.sh
artifacts:
paths:
- boinc.json
test:json:
image: python:3-alpine
stage: test
before_script:
- pip install requests
script:
- python validate.py ${ZOE_VALIDATION_URL} boinc.json
push:all:
stage: push
script:
- docker push ${DOCKER_REGISTRY}/${REPOSITORY}/boinc:${VERSION}
only:
- master
pull:all:
stage: pull
script:
- docker -H ${SWARM} ${SWARM_TLS_OPTIONS} pull ${DOCKER_REGISTRY}/${REPOSITORY}/boinc:${VERSION}
only:
- master
deploy:json:
stage: deploy
script:
- mkdir -p ${ZAPP_SHOP_BASE_PATH}/${CI_PROJECT_NAME}
- cp *.json ${ZAPP_SHOP_BASE_PATH}/${CI_PROJECT_NAME}/
- cp logo.png ${ZAPP_SHOP_BASE_PATH}/${CI_PROJECT_NAME}/
- cp README*.md ${ZAPP_SHOP_BASE_PATH}/${CI_PROJECT_NAME}/
artifacts:
paths:
- "*.json"
- logo.png
- "README*.md"
only:
- master
{
"version": 1,
"category": "Boinc",
"zapps": [
{
"category": "Non-interactive",
"name": "Boinc client",
"description": "boinc.json",
"readable_descr": "README.md",
"parameters": [
{
"kind": "environment",
......
#!/usr/bin/python
import json
import sys
import requests
URL = sys.argv[1]
files = sys.argv[2:]
for f in files:
data = json.load(open(f, encoding="utf-8"))
data_req = { "application": data }
r = requests.post(URL, json=data_req)
if r.status_code != 200:
rep = r.json()
print(rep['message'])
sys.exit(1)
#!/bin/bash
set -e
VALIDATION_URL=${VALIDATION_URL:-http://localhost:5001/api/0.7/zapp_validation}
tempfile=`mktemp`
trap "{ rm -f $tempfile; }" EXIT
for json in *.json; do
echo '{"application":' > $tempfile
cat $json >> $tempfile
echo '}' >> $tempfile
if ! curl -s -X POST -H "Content-Type: application/json" -d @$tempfile -w "code:%{http_code}" -o $tempfile $VALIDATION_URL | grep 'code:200'; then
printf "`cat $tempfile`"
echo
exit 1
fi
done
Markdown is supported
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