Commit bf88af49 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Added CI

parent f4f6471a
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+25 −0
Original line number Diff line number Diff line
stages:
  - test
  - dockerize

test:
  stage: test
  tags:
    - docker
  script:
    - mvn clean test
    - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print "coverage=" 100*covered/instructions }' target/site/jacoco/jacoco.csv
  coverage: '/coverage=\d+\.\d+/'
  only:
    - master

deploy:
  stage: dockerize
  tags:
    - shell
  only:
    - master
  script:
    - docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
    - docker build -t "${CI_REGISTRY_IMAGE}" .
    - docker push "${CI_REGISTRY_IMAGE}"

Dockerfile

0 → 100644
+11 −0
Original line number Diff line number Diff line
FROM maven:3.6.3-openjdk-14

ADD src /src
ADD pom.xml .

RUN mvn clean package -DskipTests -DfinalName=vospace-file-service

FROM openjdk:14-jdk-alpine
COPY --from=0 /target/vospace-file-service.jar /vospace-file-service.jar

ENTRYPOINT ["java","-jar","/vospace-file-service.jar"]
+6 −0
Original line number Diff line number Diff line
@@ -3,3 +3,9 @@
This service queries the same database used by VOSpace (`file_catalog`).

It provides functionalities for downloading and uploading files.

## Running with Docker

See `docker-env` file for configuration

    docker run -it --env-file docker-env -v "/path/to/userspace:/tmp/fsdemo" -p 8080:8080 git.ia2.inaf.it:5050/ia2/vospace-file-service

docker-env

0 → 100644
+8 −0
Original line number Diff line number Diff line
path_prefix=/tmp/fsdemo

file-catalog.datasource.jdbc-url=jdbc:postgresql://172.19.0.1:5432/vospace_testdb
file-catalog.datasource.username=postgres
file-catalog.datasource.password=

gms_base_url=https://sso.ia2.inaf.it/gms
jwks_uri=https://sso.ia2.inaf.it/rap-ia2/auth/oidc/jwks
+37 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

    <properties>
        <java.version>14</java.version>
        <finalName>${project.artifactId}-${project.version}</finalName>
    </properties>

    <dependencies>
@@ -58,11 +59,46 @@
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>ia2-snapshots</id>
            <name>your custom repo</name>
            <url>http://repo.ia2.inaf.it/maven/repository/snapshots</url>
        </repository>
    </repositories>
    
    <build>
        <finalName>${finalName}</finalName>
        <plugins>            
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <executable>true</executable>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.6</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>