File tree 6 files changed +86
-1
lines changed
java/io/apicurio/registry/storage/impl/sql
resources/io/apicurio/registry/storage/impl/sql
6 files changed +86
-1
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ npm install -g @stoplight/spectral-cli
Original file line number Diff line number Diff line change
1
+ name : Linting Workflow
2
+ on :
3
+ push :
4
+ paths-ignore :
5
+ - ' .gitignore'
6
+ - ' LICENSE'
7
+ - ' README*'
8
+ - ' docs/**'
9
+ branches : [master]
10
+ pull_request :
11
+ paths-ignore :
12
+ - ' .gitignore'
13
+ - ' LICENSE'
14
+ - ' README*'
15
+ - ' docs/**'
16
+ branches : [master, 2.0.x]
17
+
18
+ jobs :
19
+ lint :
20
+ name : Lint
21
+ runs-on : ubuntu-18.04
22
+ if : github.repository_owner == 'Apicurio'
23
+ steps :
24
+ - name : Checkout Code with Ref '${{ github.ref }}'
25
+ uses : actions/checkout@v2
26
+
27
+ - name : Install tools
28
+ run : .github/scripts/install-tools.sh
29
+
30
+ - name : Run linter
31
+ run : ./scripts/validate-files.sh
Original file line number Diff line number Diff line change 108
108
import io .apicurio .registry .types .RuleType ;
109
109
import io .apicurio .registry .types .provider .ArtifactTypeUtilProvider ;
110
110
import io .apicurio .registry .types .provider .ArtifactTypeUtilProviderFactory ;
111
+ import io .apicurio .registry .utils .IoUtil ;
111
112
import io .apicurio .registry .utils .StringUtil ;
112
113
import io .apicurio .registry .utils .impexp .ArtifactRuleEntity ;
113
114
import io .apicurio .registry .utils .impexp .ArtifactVersionEntity ;
125
126
*/
126
127
public abstract class AbstractSqlRegistryStorage extends AbstractRegistryStorage {
127
128
128
- private static int DB_VERSION = 5 ;
129
+ private static int DB_VERSION = Integer .valueOf (
130
+ IoUtil .toString (AbstractSqlRegistryStorage .class .getResourceAsStream ("db-version" ))).intValue ();
129
131
private static final Object dbMutex = new Object ();
130
132
private static final Object inmemorySequencesMutex = new Object ();
131
133
@@ -230,6 +232,7 @@ private boolean isDatabaseInitialized(Handle handle) {
230
232
*/
231
233
private boolean isDatabaseCurrent (Handle handle ) {
232
234
log .info ("Checking to see if the DB is up-to-date." );
235
+ log .info ("Build's DB version is {}" , DB_VERSION );
233
236
int version = this .getDatabaseVersion (handle );
234
237
return version == DB_VERSION ;
235
238
}
Original file line number Diff line number Diff line change
1
+ 5
Original file line number Diff line number Diff line change
1
+ const seen = [ ] ;
2
+ var notRepeated = function ( value ) {
3
+ if ( seen . includes ( value ) ) {
4
+ return [ {
5
+ message : `Duplicated value '${ value } '`
6
+ } ] ;
7
+ } else {
8
+ seen . push ( value ) ;
9
+ }
10
+ return [ ] ;
11
+ }
12
+
13
+ module . exports = {
14
+ rules : {
15
+ "parameters-not-repeated" : {
16
+ message : "{{error}}" ,
17
+ given : "$.parameters[*].name" ,
18
+ severity : "error" ,
19
+ then : {
20
+ function : notRepeated ,
21
+ } ,
22
+ } ,
23
+ } ,
24
+ } ;
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # DB_VERSION_BUILD=$(yq .project.properties."registry.sql.storage.db-version" app/pom.xml -r)
4
+ DB_VERSION_BUILD=$( cat app/src/main/resources/io/apicurio/registry/storage/impl/sql/db-version)
5
+ echo " Build's DB version is $DB_VERSION_BUILD "
6
+
7
+ DDLS=" app/src/main/resources/io/apicurio/registry/storage/impl/sql/postgresql.ddl app/src/main/resources/io/apicurio/registry/storage/impl/sql/h2.ddl"
8
+ for ddl in $DDLS
9
+ do
10
+ echo " Processing DDL $ddl "
11
+ DB_VERSION_INSERT=$( grep " INSERT INTO apicurio (prop_name, prop_value) VALUES ('db_version'" $ddl )
12
+ DB_VERSION_IN_DDL=$( echo $DB_VERSION_INSERT | awk ' { print $8 }' - | awk -F " )" ' { print $1}' -)
13
+ echo " DB version in DDL is $DB_VERSION_IN_DDL "
14
+
15
+ if (( $(echo "$DB_VERSION_BUILD $DB_VERSION_IN_DDL " | awk '{print ($1 != $2 )}') )) ; then
16
+ echo " DB version mismatch between DDL and build"
17
+ exit 1
18
+ fi
19
+ done
20
+ echo " DB version ok between build and DDLs"
21
+
22
+ echo " Linting openshift templates"
23
+ spectral lint distro/openshift-template/mt/apicurio-registry-mt-template.yaml --ruleset scripts/ocp-template-ruleset.js
You can’t perform that action at this time.
0 commit comments