FROM ubuntu:18.04
-RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install git \
- make python3 debhelper python3-setuptools apt-utils
+RUN apt-get update && apt-get install -y git build-essential curl \
+ && curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
+ && echo "deb https://deb.nodesource.com/node_10.x bionic main" | tee -a /etc/apt/sources.list.d/nodesource.list \
+ && echo "deb-src https://deb.nodesource.com/node_10.x bionic main" | tee -a /etc/apt/sources.list.d/nodesource.list \
+ && apt-get update && apt-get install -y nodejs
+RUN npm install --save @openapi-contrib/json-schema-to-openapi-schema
+RUN npm install -g swagger-cli
+RUN npm install -g speccy
+
properties([
parameters([
string(defaultValue: env.BRANCH_NAME, description: '', name: 'GERRIT_BRANCH'),
- string(defaultValue: 'osm/TEMPLATE', description: '', name: 'GERRIT_PROJECT'),
+ string(defaultValue: 'osm/SOL003', description: '', name: 'GERRIT_PROJECT'),
string(defaultValue: env.GERRIT_REFSPEC, description: '', name: 'GERRIT_REFSPEC'),
string(defaultValue: env.GERRIT_PATCHSET_REVISION, description: '', name: 'GERRIT_PATCHSET_REVISION'),
string(defaultValue: 'https://osm.etsi.org/gerrit', description: '', name: 'PROJECT_URL_PREFIX'),
devops_checkout()
ci_stage_2 = load "devops/jenkins/ci-pipelines/ci_stage_2.groovy"
- ci_stage_2.ci_pipeline( 'TEMPLATE',
+ ci_stage_2.ci_pipeline( 'SOL003',
params.PROJECT_URL_PREFIX,
params.GERRIT_PROJECT,
params.GERRIT_BRANCH,
#!/bin/sh
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-echo "TEST"
+#
+specfiles=$(ls | egrep "^[^.]*.(json|yaml)")
+
+fres=0
+for i in $specfiles ; do
+ echo "-- Validating and linting OpenAPI file $i..."
+ swagger-cli validate "$i"
+ res=$?
+ speccy lint "$i" --skip openapi-tags-alphabetical
+ res2=$?
+ fres=$(($fres||$res||$res2))
+ echo "--- Validator returned $res, linter returned $res2."
+done
+
+echo "-- Final validation returns $fres."
+
+exit $fres
+