Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: base refactoring #25

Merged
merged 8 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up JDK 21
uses: actions/setup-java@v3
- name: Set up JDK 23
uses: oracle-actions/setup-java@v1
with:
java-version: '21'
cache: maven
distribution: 'temurin'
website: oracle.com
java-version: '23'

- name: "Install prerequisites"
run: |
Expand Down
41 changes: 11 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ lint: ## Run Apache Spotless linter
@mvn spotless:apply

.PHONY: create-local-client
create-local-client: ## Create ResourceTracker local directory for client
create-local-client: ## Create RepoAchiever local directory for client
.PHONY: create-local-client
create-local-client: ## Create ResourceTracker local directory for client
create-local-client: ## Create RepoAchiever local directory for client
@mkdir -p $(HOME)/.repoachiever/config/swap

.PHONY: create-local-api-server
create-local-api-server: ## Create ResourceTracker local directory for API Server
create-local-api-server: ## Create RepoAchiever local directory for API Server
@mkdir -p $(HOME)/.repoachiever/config
@mkdir -p $(HOME)/.repoachiever/diagnostics/prometheus/internal
@mkdir -p $(HOME)/.repoachiever/diagnostics/prometheus/config
Expand All @@ -57,13 +57,6 @@ clone-api-server-config: ## Clone RepoAchiever API Server configuration files to
@cp -r ./config/prometheus/prometheus.tmpl $(HOME)/.repoachiever/diagnostics/prometheus/config
@cp -r ./samples/config/api-server/api-server.yaml $(HOME)/.repoachiever/config

.PHONY: clone-worker
clone-worker: ## Clone Worker JAR into a RepoAchiever local directory
ifeq (,$(wildcard $(HOME)/.repoachiever/bin/worker))
@mkdir -p $(HOME)/.repoachiever/bin
endif
@cp -r ./bin/worker $(HOME)/.repoachiever/bin/

.PHONY: clone-cluster
clone-cluster: ## Clone Cluster JAR into a RepoAchiever local directory
ifeq (,$(wildcard $(HOME)/.repoachiever/bin/cluster))
Expand All @@ -78,27 +71,15 @@ ifeq (,$(wildcard $(HOME)/.repoachiever/bin/api-server))
endif
@cp -r ./bin/api-server $(HOME)/.repoachiever/bin/

.PHONY: build-worker
build-worker: clean ## Build Worker application
ifneq (,$(wildcard ./bin/worker))
@rm -r ./bin/worker
endif
ifeq ($(dev), 'false')
@mvn -pl worker -T10 install
else
@mvn -P dev -pl worker -T10 install
endif
$(MAKE) clone-worker

.PHONY: build-cluster
build-cluster: clean ## Build Cluster application
ifneq (,$(wildcard ./bin/cluster))
@rm -r ./bin/cluster
endif
ifeq ($(dev), 'false')
@mvn -pl cluster -T10 install
@mvn -pl cluster -T10 install -U
else
@mvn -P dev -pl cluster -T10 install
@mvn -P dev -pl cluster -T10 install -U
endif
$(MAKE) clone-cluster

Expand All @@ -108,9 +89,9 @@ ifneq (,$(wildcard ./bin/api-server))
@rm -r ./bin/api-server
endif
ifeq ($(dev), 'false')
@mvn -pl api-server -T10 install
@mvn -pl api-server -T10 install -U
else
@mvn -P dev -pl api-server -T10 install
@mvn -P dev -pl api-server -T10 install -U
endif
$(MAKE) clone-api-server

Expand All @@ -120,9 +101,9 @@ ifneq (,$(wildcard ./bin/cli))
@rm -r ./bin/cli
endif
ifeq ($(dev), 'false')
@mvn -pl cli -T10 install
@mvn -pl cli -T10 install -U
else
@mvn -P dev -pl cli -T10 install
@mvn -P dev -pl cli -T10 install -U
endif

.PHONY: build-gui
Expand All @@ -131,7 +112,7 @@ ifneq (,$(wildcard ./bin/gui))
@rm -r ./bin/gui
endif
ifeq ($(dev), 'false')
@mvn -pl gui -T10 install
@mvn -pl gui -T10 install -U
else
@mvn -P dev -pl gui -T10 install
@mvn -P dev -pl gui -T10 install -U
endif
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# RepoAchiever

[![Build](https://github.com/YarikRevich/RepoAchiever/actions/workflows/build.yml/badge.svg)](https://github.com/YarikRevich/ResourceTracker/actions/workflows/build.yml)
[![Build](https://github.com/YarikRevich/RepoAchiever/actions/workflows/build.yml/badge.svg)](https://github.com/YarikRevich/RepoAchiever/actions/workflows/build.yml)
![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)
![MacOS](https://img.shields.io/badge/MacOS-8773f5?style=for-the-badge&logo=macos&logoColor=black)
![OpenJDK](https://img.shields.io/badge/JDK-23-65bd60?style=for-the-badge)
[![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)

## General Information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Service used for logging fatal level application state changes.
*/
@Plugin(name = "FatalAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE)
@Plugin(name = "fatalappender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE)
public class FatalAppender extends AbstractAppender {
protected FatalAppender(String name, Filter filter) {
super(name, filter, null, false, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public void destroy(ContentWithdrawal contentWithdrawal) throws RepositoryConten
contentWithdrawal.getCredentials().getInternal().getId(),
credentials);
} catch (RepositoryOperationFailureException e) {
throw new RepositoryContentDestructionFailureException(e.getMessage());
return;
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public ContentRetrievalResult retrieveContent(ContentRetrievalApplication conten
throw new ClusterContentRetrievalFailureException(e.getMessage());
}


List<String> additionalContentUnits;

try {
Expand Down Expand Up @@ -368,6 +367,8 @@ public void destroy(ContentWithdrawal contentWithdrawal) throws ClusterWithdrawa
logger.info(
String.format("Removing RepoAchiever Cluster allocation: '%s'", clusterAllocation.getName()));

System.out.println(clusterAllocation.getPid());

try {
clusterService.destroy(clusterAllocation.getPid());
} catch (ClusterDestructionFailureException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public ClusterDestroyCommandService(Integer pid) {

this.command = switch (osType) {
case WINDOWS -> null;
case UNIX, MAC, ANY -> String.format("kill -15 %d", pid);
case UNIX, MAC, ANY -> String.format("kill -9 %d", pid);
};
}

Expand Down
2 changes: 1 addition & 1 deletion cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<artifactId>cli</artifactId>
<version>1.0-SNAPSHOT</version>
<name>cli</name>
<description>CLI for ResourceTracker</description>
<description>CLI for RepoAchiever</description>

<parent>
<groupId>com.repoachiever</groupId>
Expand Down
8 changes: 4 additions & 4 deletions cluster/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
</plugin>
<plugin>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>19</source>
<target>19</target>
<source>22</source>
<target>22</target>
</configuration>
</plugin>
</plugin> -->
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions config/grafana/datasources/datasource.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ datasources:
tlsAuthWithCACert: false
version: 1
editable: false


2 changes: 2 additions & 0 deletions config/prometheus/prometheus.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ scrape_configs:

static_configs:
- targets: ['${(nodeexporter.host)}:${(nodeexporter.port)}']


2 changes: 1 addition & 1 deletion gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<artifactId>gui</artifactId>
<version>1.0-SNAPSHOT</version>
<name>gui</name>
<description>GUI for ResourceTracker</description>
<description>GUI for RepoAchiever</description>

<parent>
<groupId>com.repoachiever</groupId>
Expand Down
30 changes: 19 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.repoachiever</groupId>
Expand All @@ -23,10 +25,6 @@
</modules>

<properties>
<java.release>21</java.release>
<java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<main.basedir>${project.basedir}</main.basedir>
<default.package>com.repoachiever</default.package>
</properties>
Expand Down Expand Up @@ -225,6 +223,11 @@
</dependency>

<!-- THIRD PARTY -->
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.15.3</version>
</dependency>
<dependency>
<groupId>io.pebbletemplates</groupId>
<artifactId>pebble</artifactId>
Expand Down Expand Up @@ -279,7 +282,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<version>1.18.34</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -452,7 +455,7 @@
<includes>
<include>src/main/java/**/*.java</include>
</includes>
<endWithNewline/>
<endWithNewline />
<indent>
<tabs>true</tabs>
<spacesPerTab>2</spacesPerTab>
Expand Down Expand Up @@ -533,9 +536,14 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>21</source>
<target>21</target>
<compilerArgs>--enable-preview</compilerArgs>
<release>22</release>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>

Expand Down Expand Up @@ -622,4 +630,4 @@
</plugins>
</pluginManagement>
</build>
</project>
</project>
2 changes: 1 addition & 1 deletion samples/config/api-server/api-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ resource:
# Represents the highest amount of downloaded content versions per each.
max-versions: 5

# Represents a set of options used for RepoAchiever Worker configuration.
# Represents a set of options used for RepoAchiever Cluster worker configuration.
worker:
# Represents frequency of requests to selected VCS provider resources.
frequency: "0/30 * * * * ?"
38 changes: 37 additions & 1 deletion samples/config/client/user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,42 @@ content:

# Enables additional content download of repositories of VCS provider repositories.
additional: true
- name: "[YarikRevich]scripts:master" # Represents location definition name.

# Enables additional content download of repositories of VCS provider repositories.
additional: true
- name: "[YarikRevich]odb:master" # Represents location definition name.

# Enables additional content download of repositories of VCS provider repositories.
additional: true
- name: "[YarikRevich]tetris:main" # Represents location definition name.

# Enables additional content download of repositories of VCS provider repositories.
additional: true
- name: "[YarikRevich]tmpm:master" # Represents location definition name.

# Enables additional content download of repositories of VCS provider repositories.
additional: true
- name: "[YarikRevich]portfolio:master" # Represents location definition name.

# Enables additional content download of repositories of VCS provider repositories.
additional: true
- name: "[YarikRevich]ai-commit-generator:master" # Represents location definition name.

# Enables additional content download of repositories of VCS provider repositories.
additional: true
- name: "[YarikRevich]website:main" # Represents location definition name.

# Enables additional content download of repositories of VCS provider repositories.
additional: true
- name: "[YarikRevich]vim-config:master" # Represents location definition name.

# Enables additional content download of repositories of VCS provider repositories.
additional: true
- name: "[YarikRevich]critical_db_framework:master" # Represents location definition name.

# Enables additional content download of repositories of VCS provider repositories.
additional: true

# Represents section used for VCS provider configuration.
service:
Expand All @@ -27,7 +63,7 @@ service:
id: "1"

# Represents authentication token intended to be used for VCS provider API access permission.
token: "ghp_UMz4cQAD87xXAtEbsPazlRcLw7kVPu1zF8bq"
token: ""

# Represents section used for RepoAchiever API Server configuration.
api-server:
Expand Down
Loading