Skip to content

Commit

Permalink
Resolve conflicts after merging develop, #TASK-4225
Browse files Browse the repository at this point in the history
  • Loading branch information
jtarraga committed Jun 27, 2023
2 parents 4cf8320 + 5431981 commit 1ae5500
Show file tree
Hide file tree
Showing 57 changed files with 881 additions and 539 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
jobs:
build:
uses: opencb/java-common-libs/.github/workflows/build-java-app-workflow.yml@develop
with:
maven_opts: -DCELLBASE.WAR.NAME=cellbase

test:
uses: ./.github/workflows/test-analysis.yml
Expand All @@ -20,14 +22,14 @@ jobs:
report_dir: ${{ github.ref_name }}/cellbase/${{ github.sha }}

deploy-maven:
uses: opencb/java-common-libs/.github/workflows/deploy-maven-repository-workflow.yml@develop
uses: opencb/java-common-libs/.github/workflows/deploy-maven-repository-workflow.yml@release-4.6.x
needs: test
with:
maven_opts: -Dcheckstyle.skip -DCELLBASE.WAR.NAME=cellbase
secrets: inherit

deploy-docker:
uses: opencb/java-common-libs/.github/workflows/deploy-docker-hub-workflow.yml@develop
uses: opencb/java-common-libs/.github/workflows/deploy-docker-hub-workflow.yml@release-4.6.x
needs: test
with:
cli: python3 ./build/cloud/docker/docker-build.py push --images base
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
build:
uses: opencb/java-common-libs/.github/workflows/build-java-app-workflow.yml@develop
with:
maven_opts: -DCELLBASE.WAR.NAME=cellbase

test:
uses: ./.github/workflows/test-analysis.yml
Expand All @@ -19,27 +21,27 @@ jobs:
report_dir: cellbase

deploy-maven:
uses: opencb/java-common-libs/.github/workflows/deploy-maven-repository-workflow.yml@develop
uses: opencb/java-common-libs/.github/workflows/deploy-maven-repository-workflow.yml@release-4.6.x
needs: test
with:
maven_opts: -Dcheckstyle.skip -DCELLBASE.WAR.NAME=cellbase
secrets: inherit

deploy-docker:
uses: opencb/java-common-libs/.github/workflows/deploy-docker-hub-workflow.yml@develop
uses: opencb/java-common-libs/.github/workflows/deploy-docker-hub-workflow.yml@release-4.6.x
needs: test
with:
cli: python3 ./build/cloud/docker/docker-build.py push --images base
secrets: inherit

deploy-python:
uses: opencb/java-common-libs/.github/workflows/deploy-python-workflow.yml@develop
uses: opencb/java-common-libs/.github/workflows/deploy-python-workflow.yml@release-4.6.x
needs: test
with:
cli: bash ./clients/python/python-build.sh push
artifact: build-folder
secrets: inherit

release:
uses: opencb/java-common-libs/.github/workflows/release-github-workflow.yml@develop
uses: opencb/java-common-libs/.github/workflows/release-github-workflow.yml@release-4.6.x
needs: [deploy-maven, deploy-docker, deploy-python]
29 changes: 29 additions & 0 deletions .github/workflows/scripts/get_same_branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

BRANCH_NAME=$1

if [[ -z $BRANCH_NAME ]]; then
echo "The first parameter is mandatory and must be a valid branch name."
exit 1
fi

if [[ $BRANCH_NAME != "TASK-"* ]]; then
echo "No need to check dependencies."
exit 0
fi

function install(){
local REPO=$1
cd /home/runner/work/ || exit 2
git clone https://github.com/opencb/"$REPO".git -b "$BRANCH_NAME"
if [ -d "./$REPO" ]; then
cd "$REPO" || exit 2
echo "Branch name $BRANCH_NAME already exists."
mvn clean install -DskipTests
else
echo "$CURRENT Branch is NOT EQUALS $BRANCH_NAME "
fi
}

install "java-common-libs"
install "biodata"
32 changes: 4 additions & 28 deletions .github/workflows/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
branches:
- TASK-*
workflow_dispatch:

jobs:
build:
uses: opencb/java-common-libs/.github/workflows/build-java-app-workflow.yml@develop
with:
maven_opts: -DCELLBASE.WAR.NAME=cellbase

test:
uses: ./.github/workflows/test-analysis.yml
Expand All @@ -19,36 +21,10 @@ jobs:
report_dir: ${{ github.ref_name }}/cellbase/${{ github.sha }}

deploy-docker:
uses: opencb/java-common-libs/.github/workflows/deploy-docker-hub-workflow.yml@develop
uses: opencb/java-common-libs/.github/workflows/deploy-docker-hub-workflow.yml@release-4.6.x
needs: test
with:
cli: python3 ./build/cloud/docker/docker-build.py push --images base --tag ${{ github.ref_name }}
secrets: inherit

deploy-maven:
uses: opencb/java-common-libs/.github/workflows/deploy-maven-repository-workflow.yml@develop
needs: [ build, test ]
with:
maven_opts: -Dcheckstyle.skip -DCELLBASE.WAR.NAME=cellbase
if: contains( needs.build.outputs.version ,'TASK')
secrets: inherit

#The following jobs are to see that the previous if does not fail and that the maven deploy is executed because it is true
snapshot-version:
name: Check SNAPSHOT version
needs: [ build, test ]
if: contains(needs.build.outputs.version ,'SNAPSHOT')
runs-on: ubuntu-22.04
steps:
- name: test-version-from-check
run: echo "Project version is " ${{ needs.build.outputs.version }}

task-version:
name: Check TASK version
needs: [ build, test ]
if: contains(needs.build.outputs.version ,'TASK')
runs-on: ubuntu-22.04
steps:
- name: test-version-from-check
run: echo "Project version is " ${{ needs.build.outputs.version }}

10 changes: 9 additions & 1 deletion .github/workflows/test-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
type: string
required: true
env:
xb_version: "1.6.1"
xb_version: "1.7.0"
jobs:
test:
name: Test and push Sonar analysis
Expand All @@ -40,6 +40,14 @@ jobs:
with:
mongodb-version: 6.0
mongodb-replica-set: rs-test
- name: Install dependencies branches
run: |
if [ -f "./.github/workflows/scripts/get_same_branch.sh" ]; then
chmod +x ./.github/workflows/scripts/get_same_branch.sh
./.github/workflows/scripts/get_same_branch.sh ${{ github.ref_name }}
else
echo "./.github/workflows/scripts/get_same_branch.sh does not exist."
fi
- name: Test and Analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down
5 changes: 3 additions & 2 deletions cellbase-app/app/cloud/docker/cellbase-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Based on Debian 11 (bullseye)
FROM openjdk:11-jre
## Based on Ubuntu 22.04 (jammy)
## We are now using OpenJDK 8u372 to support "cgroup v2", see https://developers.redhat.com/articles/2023/04/19/openjdk-8u372-feature-cgroup-v2-support#
FROM eclipse-temurin:8u372-b07-jre-jammy

LABEL org.label-schema.vendor="OpenCB" \
org.label-schema.name="cellbase-base" \
Expand Down
22 changes: 0 additions & 22 deletions cellbase-app/app/cloud/docker/cellbase-base/Dockerfile.alpine

This file was deleted.

2 changes: 1 addition & 1 deletion cellbase-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.opencb.cellbase</groupId>
<artifactId>cellbase</artifactId>
<version>5.5.0-SNAPSHOT</version>
<version>5.6.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.config.Configurator;
import org.opencb.cellbase.client.config.ClientConfiguration;
import org.opencb.cellbase.core.config.CellBaseConfiguration;
import org.opencb.cellbase.core.exception.CellBaseException;
import org.opencb.commons.utils.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.core.config.Configurator;

import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -204,5 +204,4 @@ protected void makeDir(Path folderPath) throws IOException {
Files.createDirectories(folderPath);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,11 @@ public class DataReleaseCommandOptions {
@Parameter(names = {"--list"}, description = "List the data releases present in the database", arity = 0)
public boolean list;

@Parameter(names = {"--set-active"}, description = "Set the data release active", arity = 1)
public int active;
@Parameter(names = {"--update"}, description = "Data release to be updated by adding CellBase vesions", arity = 1)
public int update;

@Parameter(names = {"--add-versions"}, description = "CellBase versions separated by commas, e.g.: v5.2,v5.3. This parameter has to be used together to the parameter --update", arity = 1)
public String versions;
}

@Parameters(commandNames = {"data-token"}, commandDescription = "Manage data access tokens in order to access to restricted/licensed data sources")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import org.apache.commons.lang3.StringUtils;
import org.opencb.cellbase.app.cli.CommandExecutor;
import org.opencb.cellbase.app.cli.admin.AdminCliOptionsParser;
import org.opencb.cellbase.core.exception.CellBaseException;
import org.opencb.cellbase.lib.loader.LoadRunner;
import org.opencb.cellbase.lib.loader.LoaderException;
import org.opencb.commons.utils.FileUtils;

import java.io.File;
Expand Down Expand Up @@ -112,9 +114,9 @@ public void execute() {
}
}

private void loadIfExists(Path path, String collection) throws NoSuchMethodException, InterruptedException,
ExecutionException, InstantiationException, IOException, IllegalAccessException, InvocationTargetException,
ClassNotFoundException {
private void loadIfExists(Path path, String collection) throws NoSuchMethodException, InterruptedException, ExecutionException,
InstantiationException, IOException, IllegalAccessException, InvocationTargetException, ClassNotFoundException,
LoaderException, CellBaseException {
File file = new File(path.toString());
if (file.exists()) {
if (file.isFile()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
package org.opencb.cellbase.app.cli.admin.executors;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.StringUtils;
import org.opencb.cellbase.app.cli.CommandExecutor;
import org.opencb.cellbase.app.cli.admin.AdminCliOptionsParser;
import org.opencb.cellbase.core.models.DataRelease;
import org.opencb.cellbase.core.result.CellBaseDataResult;
import org.opencb.cellbase.lib.managers.DataReleaseManager;

import java.util.Arrays;
import java.util.List;

public class DataReleaseCommandExecutor extends CommandExecutor {
Expand Down Expand Up @@ -51,29 +53,28 @@ public void execute() {

DataReleaseManager dataReleaseManager = new DataReleaseManager(database, configuration);

DataRelease dataRelease;
if (dataReleaseCommandOptions.create) {
// Create release
DataRelease dataRelease = dataReleaseManager.createRelease();
dataRelease = dataReleaseManager.createRelease();
System.out.println("\nData release " + dataRelease.getRelease() + " was created.");
System.out.println("Data release description (in JSON format):");
System.out.println(new ObjectMapper().writerFor(DataRelease.class).writeValueAsString(dataRelease));
} else if (dataReleaseCommandOptions.active > 0) {
// Set-active release
CellBaseDataResult<DataRelease> results = dataReleaseManager.getReleases();
for (DataRelease dr : results.getResults()) {
if (dr.isActive() && dr.getRelease() == dataReleaseCommandOptions.active) {
logger.info("Data release " + dataReleaseCommandOptions.active + " is already active");
return;
}
}
DataRelease dataRelease = dataReleaseManager.active(dataReleaseCommandOptions.active);
if (dataRelease != null) {
System.out.println("\nThe data release " + dataRelease.getRelease() + " is the active one.");
System.out.println("Data release description (in JSON format):");
System.out.println(new ObjectMapper().writerFor(DataRelease.class).writeValueAsString(dataRelease));
} else {
logger.error("It could not set to active the data release " + dataReleaseCommandOptions.active);
} else if (dataReleaseCommandOptions.update > 0) {
if (StringUtils.isEmpty(dataReleaseCommandOptions.versions)) {
throw new IllegalArgumentException("Missing CellBase versions to be added when updating data release");
}

// Versions to be added
List<String> versions = Arrays.asList(dataReleaseCommandOptions.versions.split(","));

// Update data release
dataReleaseManager.update(dataReleaseCommandOptions.update, versions);

dataRelease = dataReleaseManager.get(dataReleaseCommandOptions.update);
System.out.println("\nData release " + dataRelease.getRelease() + " was updated.");
System.out.println("Data release description (in JSON format):");
System.out.println(new ObjectMapper().writerFor(DataRelease.class).writeValueAsString(dataRelease));
} else if (dataReleaseCommandOptions.list) {
// List releases
CellBaseDataResult<DataRelease> dataReleases = dataReleaseManager.getReleases();
Expand All @@ -94,11 +95,11 @@ private void checkParameters() {
if (dataReleaseCommandOptions.list) {
opts++;
}
if (dataReleaseCommandOptions.active > 0) {
if (dataReleaseCommandOptions.update > 0) {
opts++;
}
if (opts > 1) {
throw new IllegalArgumentException("Please, select only one of these input parameters: create, list or set-active");
if (opts != 1) {
throw new IllegalArgumentException("Please, select only one of these input parameters: create, update or list");
}
}
}
Loading

0 comments on commit 1ae5500

Please sign in to comment.