Skip to content

Commit

Permalink
Fix artefact upload on gha
Browse files Browse the repository at this point in the history
  • Loading branch information
bwerquin committed Jan 27, 2022
1 parent 49e83b7 commit 03602a3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Upload war
uses: actions/upload-artifact@v2
with:
name: war
path: target/*.war
name: jar
path: target/*.jar
release:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
id: download
uses: actions/download-artifact@v2
with:
name: war
name: jar
path: target/
- name: Get current version
id: version
Expand Down
2 changes: 1 addition & 1 deletion deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ spec:
spec:
containers:
- name: knowledge-bo
image: bwerquin/knowledge-back-office:0.0.5
image: bwerquin/knowledge-back-office:0.0.6
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>fr.insee.knowledge</groupId>
<artifactId>knowledge</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
<packaging>jar</packaging>
<name>Knowledge-Back-Office</name>
<description>Back-office services for Knowledge</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ public class KnowledgeObjectsAPI {
@Autowired
FunctionDataAccess functionDataAccess;

@Autowired
ProductDataAccess productDataAccess;

/**
* This method is using to get function JSON representation from MongoDB
*
* @return List of all {@link Service}
* @return List of all {@link FunctionDTO}
*/
@ApiOperation(value = "Get functions from mongodb")
@GetMapping(path = "/functions")
Expand All @@ -67,10 +70,42 @@ public ResponseEntity<Object> getFunctions() throws IOException, GitAPIException
LOGGER.info("fonctions.json serialized");
}
}
LOGGER.info("GET services resulting in 200");
LOGGER.info("GET functions resulting in 200");
return new ResponseEntity<>(functions, HttpStatus.OK);
}

/**
* This method is using to get product JSON representation from MongoDB
*
* @return List of all {@link Product}
*/
@ApiOperation(value = "Get product from mongodb")
@GetMapping(path = "/products")
public ResponseEntity<Object> getProducts() throws IOException, GitAPIException {
List<Product> products = null;
File localPath = File.createTempFile("GitRepositoryKnowledge", "");
Files.delete(localPath.toPath());

Git git = Git.cloneRepository()
.setURI("https://github.com/bwerquin/Knowledge-Data.git")
.setDirectory(localPath)
.call();
NotFileFilter suffixFileFilterFileFilter=new NotFileFilter(new SuffixFileFilter(new String[] { "md", "MD", ".git",".pack","idx"}));
Collection<File> files = FileUtils.listFiles(localPath, suffixFileFilterFileFilter, TrueFileFilter.INSTANCE);
for(File file2 : files){
KnowledgeFile file = new KnowledgeFile();
file.setFileName(file2.getName());
file.setFolder(file2.isDirectory());
file.setPath(file2.getPath());
if(file2.getName().toUpperCase(Locale.ROOT).equalsIgnoreCase("produits.json")){
products = productDataAccess.serializeFromFile(file);
LOGGER.info("products.json serialized");
}
}
LOGGER.info("GET products resulting in 200");
return new ResponseEntity<>(products, HttpStatus.OK);
}



}
Expand Down

0 comments on commit 03602a3

Please sign in to comment.