Skip to content

Commit

Permalink
Add script to check plugins during the CI build (eclipse-che#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuznyetsov authored Aug 23, 2018
1 parent 5cb4578 commit 3c728c8
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
language: generic
language: bash

install:
- pip install --user yq

script:
- bash check_plugins_location.sh
36 changes: 36 additions & 0 deletions check_plugins_location.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

## browse all plugin directories which names goes as follow
## <plugin id>/<plugin version>
## and check that directory names match with id/version in meta.yaml files
cd plugins
for d in */ ; do
ID_DIR_NAME=${d%/}
cd $d

VERSION_DIR_NAME=$(ls -d */)
VERSION_DIR_NAME=${VERSION_DIR_NAME%/}
cd $VERSION_DIR_NAME

ID_YAML=$(yq .id meta.yaml | sed 's/^"\(.*\)"$/\1/')
if [[ "$ID_YAML" != "$ID_DIR_NAME" ]];then
echo "!!! ID mismatch in plugin '${ID_DIR_NAME}/${VERSION_DIR_NAME}':"
echo "!!! id in meta.yaml: '${ID_YAML}'"
echo "!!! id directory name: '${ID_DIR_NAME}' "
FOUND=true
fi

VERSION_YAML=$(yq .version meta.yaml | sed 's/^"\(.*\)"$/\1/')
if [[ "$VERSION_YAML" != "$VERSION_DIR_NAME" ]];then
echo "!!! Version mismatch in plugin '${ID_DIR_NAME}/${VERSION_DIR_NAME}':"
echo "!!! version in meta.yaml: '${VERSION_YAML}'"
echo "!!! version directory name: '${VERSION_DIR_NAME}' "
FOUND=true
fi

cd ../..
done

if [[ $FOUND ]];then
exit 1
fi

0 comments on commit 3c728c8

Please sign in to comment.