Skip to content

Commit

Permalink
🗣 Release v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yodamad authored Mar 5, 2021
2 parents 85cf7bc + 400723e commit 7b8afc1
Show file tree
Hide file tree
Showing 39 changed files with 856 additions and 194 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: svn2git CI
on: [push, pull_request]
jobs:
pipeline:
name: pipeline
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.pull_request.title, '[skip ci]') && !contains(github.event.pull_request.title, '[ci skip]')"
timeout-minutes: 40
env:
NODE_VERSION: 12.16.1
SPRING_OUTPUT_ANSI_ENABLED: DETECT
SPRING_JPA_SHOW_SQL: false
JHI_DISABLE_WEBPACK_LOGS: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.16.1
- uses: actions/setup-java@v1
with:
java-version: '11.x'
- name: 🪦 Install node.js packages
run: npm install
- name: Update platform
run: sudo apt-get update
- name: Install git-svn
run: sudo apt-get install git-svn
- name: 🔍 Analyze code with SonarQube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
JASYPT_PWD: ${{ secrets.JASYPT_PWD }}
run: |
if [ -n $SONAR_TOKEN ]; then
./mvnw -ntp verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -P-webpack -Djasypt.encryptor.password=$JASYPT_PWD
else
echo No SONAR_TOKEN, skipping...
fi
- name: 📦 Package application
run: ./mvnw -ntp package -Pprod -DskipTests
- name: 🐳 Build and publish docker image
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
GIT_TAG=:${GITHUB_REF#refs/tags/}
DOCKER_TAG=${GIT_TAG#:refs/heads/main}
./mvnw -ntp jib:build -Djib.to.image=yodamad/svn2git:latest -Djib.to.auth.username="${{ secrets.DOCKERHUB_LOGIN }}" -Djib.to.auth.password="${{ secrets.DOCKERHUB_PWD }}"
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# svn2git ![Release](https://img.shields.io/github/release/yodamad/svn2git.svg?style=popout) [![Build Status](https://yodamad.visualstudio.com/svn2git/_apis/build/status/svn2git-Maven-CI?branchName=dev)](https://yodamad.visualstudio.com/svn2git/_build/latest?definitionId=1?branchName=dev) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Commit](https://img.shields.io/github/last-commit/yodamad/svn2git.svg?style=flat) ![docker](https://img.shields.io/docker/pulls/yodamad/svn2git)
# svn2git ![Release](https://img.shields.io/github/release/yodamad/svn2git.svg?style=popout) [![svn2git CI](https://github.com/yodamad/svn2git/actions/workflows/main.yml/badge.svg)](https://github.com/yodamad/svn2git/actions/workflows/main.yml) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Commit](https://img.shields.io/github/last-commit/yodamad/svn2git.svg?style=flat) ![docker](https://img.shields.io/docker/pulls/yodamad/svn2git)

This application helps you to migrate from SVN to Gitlab.

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"reflect-metadata": "0.1.13",
"rxjs": "6.4.0",
"rxjs-compat": "6.4.0",
"start": "^5.1.0",
"tslib": "1.9.3",
"zone.js": "0.8.29"
},
Expand Down
18 changes: 13 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>fr.yodamad.svn2git</groupId>
<artifactId>svn-2-git</artifactId>
<version>2.0.3</version>
<version>2.1.0</version>
<packaging>jar</packaging>
<name>Svn 2 GitLab</name>

Expand Down Expand Up @@ -77,7 +77,9 @@
<jasypt.version>3.0.3</jasypt.version>

<!-- Sonar properties -->
<sonar.host.url>http://localhost:9001</sonar.host.url>
<sonar.projectKey>yodamad_svn2git</sonar.projectKey>
<sonar.organization>yodamad-github</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.exclusions>src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.*</sonar.exclusions>
<sonar.issue.ignore.multicriteria>S3437,S4502,S4684,UndocumentedApi,BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria>
<!-- Rule https://sonarcloud.io/coding_rules?open=Web%3ABoldAndItalicTagsCheck&rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is recommended by http://fontawesome.io/examples/ -->
Expand All @@ -95,9 +97,9 @@
<!-- Rule https://sonarcloud.io/coding_rules?open=squid%3AS4684&rule_key=squid%3AS4684 -->
<sonar.issue.ignore.multicriteria.S4684.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.S4684.resourceKey>
<sonar.issue.ignore.multicriteria.S4684.ruleKey>squid:S4684</sonar.issue.ignore.multicriteria.S4684.ruleKey>
<sonar.jacoco.reportPaths>${project.testresult.directory}/coverage/jacoco/jacoco.exec</sonar.jacoco.reportPaths>
<sonar.coverage.jacoco.xmlReportPaths>${project.testresult.directory}/coverage/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.java.codeCoveragePlugin>jacoco</sonar.java.codeCoveragePlugin>
<sonar.testExecutionReportPaths>${project.testresult.directory}/jest/TESTS-results-sonar.xml</sonar.testExecutionReportPaths>
<!-- <sonar.testExecutionReportPaths>${project.testresult.directory}/jest/TESTS-results-sonar.xml</sonar.testExecutionReportPaths> -->
<sonar.typescript.lcov.reportPaths>${project.testresult.directory}/lcov.info</sonar.typescript.lcov.reportPaths>
<sonar.sources>${project.basedir}/src/main/</sonar.sources>
<sonar.surefire.reportsPath>${project.testresult.directory}/surefire-reports</sonar.surefire.reportsPath>
Expand Down Expand Up @@ -338,7 +340,7 @@
<dependency>
<groupId>org.gitlab4j</groupId>
<artifactId>gitlab4j-api</artifactId>
<version>4.12.3</version>
<version>4.15.7</version>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
Expand Down Expand Up @@ -372,6 +374,12 @@
<artifactId>markdowngenerator</artifactId>
<version>1.3.1.1</version>
</dependency>
<!-- HTTP -->
<dependency>
<groupId>khttp</groupId>
<artifactId>khttp</artifactId>
<version>0.1.0</version>
</dependency>
<!-- Artifactory -->
<dependency>
<groupId>org.jfrog.artifactory.client</groupId>
Expand Down
46 changes: 42 additions & 4 deletions src/main/java/fr/yodamad/svn2git/config/ApplicationProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class ApplicationProperties {
public Svn svn = new Svn();
public Gitlab gitlab = new Gitlab();
public Artifactory artifactory = new Artifactory();
public Nexus nexus = new Nexus();
public Password password = new Password();
public Override override = new Override();
public Flags flags = new Flags();
Expand Down Expand Up @@ -45,6 +46,10 @@ public void setArtifactory(Artifactory artifactory) {
this.artifactory = artifactory;
}

public Nexus getNexus() { return nexus; }

public void setNexus(Nexus nexus) { this.nexus = nexus; }

public Gitlab getGitlab() {
return gitlab;
}
Expand Down Expand Up @@ -189,11 +194,14 @@ public static class Gitlab {
* Dynamic Local Config
*/
public List<String> dynamicLocalConfig;

/**
* Pause between push to gitlab
*/
public long gitPushPauseMilliSeconds;
/**
* Enable package registry
*/
public Boolean uploadToRegistry = false;

public long getGitMvPauseMilliSeconds() {
return gitMvPauseMilliSeconds;
Expand Down Expand Up @@ -256,9 +264,11 @@ public List<String> getDynamicLocalConfig() {
return dynamicLocalConfig;
}

public void setDynamicLocalConfig(List<String> dynamicLocalConfig) {
this.dynamicLocalConfig = dynamicLocalConfig;
}
public void setDynamicLocalConfig(List<String> dynamicLocalConfig) { this.dynamicLocalConfig = dynamicLocalConfig; }

public Boolean getUploadToRegistry() { return uploadToRegistry; }

public void setUploadToRegistry(Boolean uploadToRegistry) { this.uploadToRegistry = uploadToRegistry; }
}

public static class Artifactory {
Expand Down Expand Up @@ -377,6 +387,34 @@ public void setBinariesDirectory(String binariesDirectory) {
public void setAccessToken(String accessToken) {this.accessToken = accessToken;}
}

public static class Nexus {
private String url;
private String user;
private String password;
private String repository;
private Boolean enabled;

public String getUrl() { return url; }

public void setUrl(String url) { this.url = url; }

public String getUser() { return user; }

public void setUser(String user) { this.user = user; }

public String getPassword() { return password; }

public void setPassword(String password) { this.password = password; }

public String getRepository() { return repository; }

public void setRepository(String repository) { this.repository = repository; }

public Boolean getEnabled() { return enabled; }

public void setEnabled(Boolean enabled) { this.enabled = enabled; }
}

public static class Password {
public String cipher;

Expand Down
26 changes: 26 additions & 0 deletions src/main/java/fr/yodamad/svn2git/domain/Migration.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public class Migration implements Serializable {
@JsonView(View.Public.class)
private String gitlabProject;

@Column(name = "gitlab_project_id")
@JsonView(View.Public.class)
private Integer gitlabProjectId;

@Enumerated(EnumType.STRING)
@Column(name = "status")
@JsonView(View.Public.class)
Expand Down Expand Up @@ -138,6 +142,10 @@ public class Migration implements Serializable {
@JsonView(View.Public.class)
private String workingDirectory;

@Column(name = "upload_type")
@JsonView(View.Public.class)
private String uploadType;

@OneToMany(mappedBy = "migration")
@OrderBy("id ASC")
private Set<MigrationHistory> histories = new HashSet<>();
Expand Down Expand Up @@ -231,6 +239,19 @@ public void setGitlabProject(String gitlabProject) {
this.gitlabProject = gitlabProject;
}

public Integer getGitlabProjectId() {
return gitlabProjectId;
}

public Migration gitlabProjectId(Integer gitlabProjectId) {
this.gitlabProjectId = gitlabProjectId;
return this;
}

public void setGitlabProjectId(Integer gitlabProjectId) {
this.gitlabProjectId = gitlabProjectId;
}

public StatusEnum getStatus() {
return status;
}
Expand Down Expand Up @@ -504,6 +525,11 @@ public Boolean getFlat() {
public void setFlat(Boolean flat) {
this.flat = flat;
}

public String getUploadType() { return uploadType; }

public void setUploadType(String uploadType) { this.uploadType = uploadType; }

// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ public enum StepEnum {
GIT_CLONE, GITLAB_PROJECT_CREATION, SVN_CHECKOUT, GIT_CLEANING, GIT_PUSH, CLEANING, GIT_MV, INIT, BRANCH_CLEAN,
TAG_CLEAN, README_MD, GIT_CONFIG_GC_AUTO_OFF, GIT_CONFIG_GLOBAL_GC_AUTO_OFF, GIT_GC_EXPLICIT,
GIT_DYNAMIC_LOCAL_CONFIG, GIT_SHOW_CONFIG, LIST_REMOVED_FILES, UPLOAD_TO_ARTIFACTORY, ARTIFACTORY_FOLDER_CLEANING,
SVN_COPY_ROOT_FOLDER, ULIMIT, GIT_SET_CONFIG
SVN_COPY_ROOT_FOLDER, ULIMIT, GIT_SET_CONFIG, UPLOAD_TO_GITLAB, UPLOAD_TO_NEXUS
}
26 changes: 26 additions & 0 deletions src/main/kotlin/fr/yodamad/svn2git/functions/HttpFunctions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package fr.yodamad.svn2git.functions

import khttp.structures.authorization.BasicAuthorization
import khttp.structures.files.FileLike

fun uploadFileToGitlab(gitlabUrl: String, gitlabToken: String, projectId: Int, projectName: String, version: String, fileName: String, filePath: String) =
khttp.put(
url = "$gitlabUrl/api/v4/projects/$projectId/packages/generic/$projectName/$version/$fileName",
headers = mapOf(
Pair("PRIVATE-TOKEN", gitlabToken)
),
files = listOf(
FileLike(fileName, filePath)
)
).statusCode

fun uploadFileToNexus(nexusUrl: String, nexusRepo: String, nexusUser: String, nexusPwd: String,
groupName: String, projectName: String, version: String,
fileName: String, filePath: String) =
khttp.put(
url = "$nexusUrl/repository/$nexusRepo/$groupName/$projectName/$version/$fileName",
auth = BasicAuthorization(nexusUser, nexusPwd),
files = listOf(
FileLike(fileName, filePath)
)
).statusCode
17 changes: 17 additions & 0 deletions src/main/kotlin/fr/yodamad/svn2git/functions/RegexFunctions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package fr.yodamad.svn2git.functions

val FULL_VERSION = "\\d+\\.\\d+\\.\\d+".toRegex()
val LITE_VERSION = "\\d+\\.\\d+".toRegex()

fun extractVersion(fullName: String): String {
var version = FULL_VERSION.find(fullName)?.groupValues?.firstOrNull()
if (version == null) {
version = LITE_VERSION.find(fullName)?.groupValues?.firstOrNull()
if (version == null) {
version = "0.0.0"
} else {
version += ".0"
}
}
return version
}
2 changes: 2 additions & 0 deletions src/main/kotlin/fr/yodamad/svn2git/init/CheckUp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package fr.yodamad.svn2git.init

import com.google.common.io.Files.createTempDir
import org.slf4j.LoggerFactory
import org.springframework.context.annotation.Profile
import org.springframework.stereotype.Component
import java.io.File
import java.io.IOException
Expand All @@ -11,6 +12,7 @@ import javax.annotation.PostConstruct
import kotlin.system.exitProcess

@Component
@Profile("dev")
class CheckUp {
private val GIT_ERROR = "⛔️ svn2git requires Git v2.20+ or newer"

Expand Down
Loading

0 comments on commit 7b8afc1

Please sign in to comment.