Skip to content

Commit

Permalink
REFV-1 initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-tschudnowsky committed Sep 9, 2022
0 parents commit 659fa83
Show file tree
Hide file tree
Showing 11 changed files with 324 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .githubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
LICENSE_HEADER
pipeline.dev.jenkinsfile
pipeline.github.jenkinsfile
pipeline.release.jenkinsfile
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*/.classpath
*/.project
*/target
*/*.log
.idea/
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (c) 2022 gematik GmbH

Licensed under the Apache License, Version 2.0 (the License);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
4 changes: 4 additions & 0 deletions LICENSE_HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
* ${GEMATIK_COPYRIGHT_STATEMENT}
*/

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Gematik Reference Validator

- TODO
3 changes: 3 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Release 0.1.0

- TODO
141 changes: 141 additions & 0 deletions jenkinsfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
@Library('gematik-jenkins-shared-library') _

def CREDENTIAL_ID_GEMATIK_GIT = 'GITLAB.tst_tt_build.Username_Password'
def BRANCH = 'master'
def JIRA_PROJECT_ID = 'REFV'
def GITLAB_PROJECT_ID = '1057'
def TAG_NAME = 'ci-build'
def POM_PATH = 'de.gematik.refv/pom.xml'
def DOCKER_FILE = "Dockerfile"
def IMAGE_NAME = "refv/referencevalidator"
def DOCKER_VERSION = "latest"

pipeline {

options {
disableConcurrentBuilds()
}
agent { label 'k8-maven' }

stages {
stage('Get Jira Version') {
steps {
script {
JIRA_VERSION = jiraCheckAndGetSingleVersion(jiraGetVersions(JIRA_PROJECT_ID))
}
}
}

stage('Generate Feature Tag') {
when { not { branch BRANCH } }
steps {
script {
DOCKER_VERSION = extendsVersionWithFeatureBranch()
}
}
}

stage('gitCreateBranch') {
when { branch BRANCH }
steps {
gitCreateBranch()
}
}

stage('set Version') {
steps {
mavenSetVersionFromJiraProject(JIRA_PROJECT_ID, POM_PATH)
}
}

stage('Build') {
steps {
mavenBuild(POM_PATH)
}
}

stage('Test') {
steps {
mavenTest(POM_PATH)
}
}

stage('OWASP') {
steps {
mavenOwaspScan(POM_PATH)
}
}

stage('Sonar') {
steps {
mavenCheckWithSonarQube(POM_PATH, "", false)
}
}

stage('deploy') {
when { branch BRANCH }
steps {
mavenDeploy(POM_PATH)
}
}

// stage('DockerBuild') {
// steps {
// dockerBuild(IMAGE_NAME, DOCKER_VERSION, JIRA_VERSION, "", DOCKER_FILE)
// }
// }
//
// stage('Switch to Docker-Agent') {
// agent { label 'k8-docker' }
// stages {
// stage('Vulnerabilities-Scan Report with ALL') {
// steps {
// trivyVulnerabilitiesScanAllAsHtml(IMAGE_NAME, DOCKER_VERSION)
// }
// }
// stage('Vulnerabilities-Scan LOW,MEDIUM') {
// steps {
// trivyVulnerabilitiesScanLowMedium(IMAGE_NAME, DOCKER_VERSION)
// }
// }
// stage('Vulnerabilities-Scan HIGH,CRITICAL') {
// steps {
// trivyVulnerabilitiesScanHighCritical(IMAGE_NAME, DOCKER_VERSION, 1)
// }
// }
// stage('Vulnerabilities-Scan Unfixed CRITICAL') {
// steps {
// trivyVulnerabilitiesScanCriticalUnfixed(IMAGE_NAME, DOCKER_VERSION)
// }
// }
// }
// }
//
// stage('push Dockerimage') {
// when { branch BRANCH }
// steps {
// dockerPushImage(IMAGE_NAME, DOCKER_VERSION)
// }
// }

stage('Tag and Push CI-build') {
when { branch BRANCH }
steps {
gitCreateAndPushTag(JIRA_PROJECT_ID)
}
}

stage('GitLab-Update-Snapshot') {
when { branch BRANCH }
steps {
gitLabUpdateMavenSnapshot(JIRA_PROJECT_ID, GITLAB_PROJECT_ID, POM_PATH)
}
}
}
post {
always {
// dockerRemoveLocalImage(IMAGE_NAME, DOCKER_VERSION)
}
}

}
5 changes: 5 additions & 0 deletions jenkinsfile.github
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@Library('gematik-jenkins-shared-library') _
pipelineGitHubPublish {
GITHUB_PROJECT_NAME = 'reference-validator'
GEMATIK_PROJECT_NAME = 'tools/gematik-referenzvalidator.git'
}
102 changes: 102 additions & 0 deletions jenkinsfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
@Library('gematik-jenkins-shared-library') _

def CREDENTIAL_ID_GEMATIK_GIT = 'GITLAB.tst_tt_build.Username_Password'
def REPO_URL = createGitUrl('git/refImpl/tools/gematik-referenzvalidator.git')
def BRANCH = 'master'
def JIRA_PROJECT_ID = 'REFV'
def GITLAB_PROJECT_ID = '1057'
def TITLE_TEXT = 'Release'
def ARTIFACT_ID = "de.gematik.refv.reference-validator"
def ARTIFACT_ID_LIST = "de.gematik.refv.reference-validator"
def GROUP_ID_PATH = "de/gematik"
def GROUP_ID = "de.gematik"
def POM_PATH = 'de.gematik.refv.referencevalidator/pom.xml'
def IMAGE_NAME = "refv/referencevalidator"
def DOCKER_PULL_VERSION = "latest"

pipeline {
options {
disableConcurrentBuilds()
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '5')
}
agent { label 'k8-maven' }

parameters {
//!!! RELEASE_VERION ist ein Eingabeparameter in Jenkins (siehe https://wiki.gematik.de/pages/viewpage.action?pageId=442577145#JenkinsReleasePipeline(Executables)-Nutzereingaben )
string(name: 'NEW_VERSION', defaultValue: '', description: 'Bitte die nächste Version für das Projekt eingeben, format [0-9]+.[0-9]+.[0-9]+ \nHinweis: Version 0.0.[0-9] ist keine gültige Version!')
}

stages {
stage('Initialise') {
steps {
checkVersion(NEW_VERSION) // Eingabe erfolgt über Benutzerinteraktion beim Start des Jobs
}
}

stage('Checkout') {
steps {
git branch: BRANCH,
credentialsId: CREDENTIAL_ID_GEMATIK_GIT,
url: REPO_URL
}
}


stage('Environment') {
environment {
LATEST = nexusGetLatestVersion(RELEASE_VERSION, ARTIFACT_ID, GROUP_ID).trim()
TAG_NAME = 'Release/ReleaseBuild'
}
stages {
stage('Create Release-Tag') {
steps {
gitCreateAndPushTag(JIRA_PROJECT_ID, "${TAG_NAME}-${LATEST}", BRANCH)
}
}

stage('Create GitLab Release') {
steps {
gitLabCreateRelease(JIRA_PROJECT_ID, GITLAB_PROJECT_ID, LATEST, ARTIFACT_ID, GROUP_ID_PATH, TITLE_TEXT, RELEASE_VERSION, "${TAG_NAME}-${LATEST}")
}
}

stage('Release Jira-Version') {
steps {
jiraReleaseVersion(JIRA_PROJECT_ID, RELEASE_VERSION)
}
}
stage('Create New Jira-Version') {
steps {
jiraCreateNewVersion(JIRA_PROJECT_ID, NEW_VERSION)
}
}
stage('UpdateProject with new Version') {
steps {
mavenSetVersion("${NEW_VERSION}-SNAPSHOT", POM_PATH)
gitPushVersionUpdate(JIRA_PROJECT_ID, "${NEW_VERSION}-SNAPSHOT", BRANCH)
}
}
stage('deleteOldArtifacts') {
steps {
nexusDeleteArtifacts(RELEASE_VERSION, ARTIFACT_ID_LIST, GROUP_ID)
}
}

// stage('Retag Docker Image'){
// steps {
// script {
// dockerPull(IMAGE_NAME, DOCKER_PULL_VERSION)
// dockerReTagImage(IMAGE_NAME, RELEASE_VERSION)
// dockerPushImage(IMAGE_NAME, RELEASE_VERSION)
// }
// }
// }
}
}
}
post {
always {
// dockerRemoveLocalImage(IMAGE_NAME, RELEASE_VERSION)
}
}
}
31 changes: 31 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.gematik.refv</groupId>
<artifactId>referencevalidator</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>gematik Referenzvalidator</name>
<url>https://github.com/gematik/referencevalidator</url>

<licenses>
<license>
<name>Apache License 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
13 changes: 13 additions & 0 deletions src/main/java/de/gematik/refv/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package de.gematik.refv;

/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

0 comments on commit 659fa83

Please sign in to comment.