Added ARM, AWS templates and pipelines.

This commit is contained in:
jefferyfry
2020-04-28 21:10:29 -07:00
parent 38d2524ee1
commit 4e9153dffa
156 changed files with 5757 additions and 725 deletions

19
Ansible/test/tests/README.md Executable file
View File

@@ -0,0 +1,19 @@
## Test framework
### How to run it locally
```
./gradlew clean commonTests
```
### Adding new tests
### Gradle cleanup. Delete the folder:
```
~/.gradle/caches/
./gradlew clean
```
### Or run
```
./gradlew clean
```

View File

@@ -0,0 +1,63 @@
plugins {
id 'groovy'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:3.0.0'
testCompile 'io.rest-assured:rest-assured:4.1.1'
testCompile 'org.testng:testng:6.14.3'
testCompile 'org.yaml:snakeyaml:1.17'
}
test {
outputs.upToDateWhen { false }
useTestNG(){
suites("src/test/groovy/testng.xml")
}
//maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
testLogging {
showStandardStreams = true
}
}
task artifactory_jcr_test(type: Test) {
useTestNG() {
useDefaultListeners = true
suites 'src/test/groovy/testng.xml'
includeGroups ('common', 'jcr')
}
testLogging {
showStandardStreams = true
}
}
task artifactory_ha_test(type: Test) {
useTestNG() {
useDefaultListeners = true
suites 'src/test/groovy/testng.xml'
includeGroups('common','pro')
}
testLogging {
showStandardStreams = true
}
}
task unified_test(type: Test) {
useTestNG() {
useDefaultListeners = true
suites 'src/test/groovy/testng.xml'
includeGroups('common','pro','xray')
}
testLogging {
showStandardStreams = true
}
}

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Wed Feb 12 10:23:21 PST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

172
Ansible/test/tests/gradlew vendored Executable file
View File

@@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
Ansible/test/tests/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1,2 @@
rootProject.name = 'fozzie_jfrog_tests'

View File

@@ -0,0 +1,139 @@
package steps
import static io.restassured.RestAssured.given
class RepositorySteps {
def getHealthCheckResponse(artifactoryURL) {
return given()
.when()
.get("http://" + artifactoryURL + "/router/api/v1/system/health")
.then()
.extract().response()
}
def ping() {
return given()
.when()
.get("/api/system/ping")
.then()
.extract().response()
}
def createRepositories(File body, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/yaml")
.body(body)
.when()
.patch("/api/system/configuration")
.then()
.extract().response()
}
// https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API#ArtifactoryRESTAPI-GetRepositories
def getRepos() {
return given()
.header("Cache-Control", "no-cache")
.header("content-Type", "application/yaml")
.when()
.get("/api/repositories")
.then()
.extract().response()
}
// https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API#ArtifactoryRESTAPI-DeleteRepository
def deleteRepository(repoName, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/yaml")
.when()
.delete("/api/repositories/" + repoName)
.then()
.extract().response()
}
def createDirectory(repoName, directoryName) {
return given()
.header("Cache-Control", "no-cache")
.header("content-Type", "application/yaml")
.when()
.put("/" + repoName + "/" + directoryName)
.then()
.extract().response()
}
def deployArtifact(repoName, directoryName, artifact, filename) {
return given()
.header("Cache-Control", "no-cache")
.header("Content-Type", "application/json")
.body(artifact)
.when()
.put("/" + repoName + "/" + directoryName + "/" + filename)
.then()
.extract().response()
}
def deleteItem(repoName, directoryName, artifact, filename) {
return given()
.header("Cache-Control", "no-cache")
.header("Content-Type", "application/json")
.body(artifact)
.when()
.delete("/" + repoName + "/" + directoryName + "/" + filename)
.then()
.extract().response()
}
def getInfo(repoName, directoryName, artifact, filename) {
return given()
.header("Cache-Control", "no-cache")
.header("Content-Type", "application/json")
.body(artifact)
.when()
.get("/api/storage/" + repoName + "/" + directoryName + "/" + filename)
.then()
.extract().response()
}
def createSupportBundle(name, startDate, endDate) {
return given()
.header("Cache-Control", "no-cache")
.header("Content-Type", "application/json")
.body("{ \n" +
" \"name\":\"${name}\",\n" +
" \"description\":\"desc\",\n" +
" \"parameters\":{ \n" +
" \"configuration\": \"true\",\n" +
" \"system\": \"true\", \n" +
" \"logs\":{ \n" +
" \"include\": \"true\", \n" +
" \"start_date\":\"${startDate}\",\n" +
" \"end_date\":\"${endDate}\"\n" +
" },\n" +
" \"thread_dump\":{ \n" +
" \"count\": 1,\n" +
" \"interval\": 0\n" +
" }\n" +
" }\n" +
"}")
.when()
.post("/api/system/support/bundle")
.then()
.extract().response()
}
}

View File

@@ -0,0 +1,196 @@
package steps
import org.testng.annotations.DataProvider
import static io.restassured.RestAssured.given
class SecuritytSteps {
def createUser(usernameRt, emailRt, passwordRt) {
return given()
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"email\" : \"${emailRt}\",\n" +
" \"password\": \"${passwordRt}\"\n" +
"}")
.when()
.put("/api/security/users/${usernameRt}")
.then()
.extract().response()
}
def getUserDetails(usernameRt) {
return given()
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.get("/api/security/users/${usernameRt}")
.then()
.extract().response()
}
def deleteUser(usernameRt) {
return given()
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.delete("/api/security/users/${usernameRt}")
.then()
.extract().response()
}
def generateAPIKey(usernameRt, passwordRt) {
return given()
.auth()
.preemptive()
.basic("${usernameRt}", "${passwordRt}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.post("/api/security/apiKey")
.then()
.extract().response()
}
def getAPIKey(usernameRt, passwordRt) {
return given()
.auth()
.preemptive()
.basic("${usernameRt}", "${passwordRt}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.get("/api/security/apiKey")
.then()
.extract().response()
}
def regenerateAPIKey(usernameRt, passwordRt) {
return given()
.auth()
.preemptive()
.basic("${usernameRt}", "${passwordRt}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.put("/api/security/apiKey")
.then()
.extract().response()
}
def createGroup(groupName) {
return given()
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\"name\": \"${groupName}\"}")
.when()
.put("/api/security/groups/${groupName}")
.then()
.extract().response()
}
def getGroup(groupName) {
return given()
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\"name\": \"${groupName}\"}")
.when()
.get("/api/security/groups/${groupName}")
.then()
.extract().response()
}
def deleteGroup(groupName) {
return given()
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.delete("/api/security/groups/${groupName}")
.then()
.extract().response()
}
def createPermissions(permissionName, repository, user1, user2,
group1, group2, action1, action2, action3) {
return given()
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"name\": \"${permissionName}\",\n" +
" \"repo\": {\n" +
" \"repositories\": [ \"${repository}\" ],\n" +
" \"actions\": {\n" +
" \"users\" : {\n" +
" \"${user1}\": [ \"${action1}\",\"${action2}\",\"${action3}\" ], \n" +
" \"${user2}\" : [ \"${action1}\",\"${action2}\",\"${action3}\" ]\n" +
" },\n" +
" \"groups\" : {\n" +
" \"${group1}\" : [ \"${action1}\",\"${action2}\",\"${action3}\" ],\n" +
" \"${group2}\" : [ \"${action1}\",\"${action2}\" ]\n" +
" }\n" +
" }\n" +
" }\n" +
"}")
.when()
.put("/api/v2/security/permissions/testPermission")
.then()
.extract().response()
}
def getPermissions( permissionName) {
return given()
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.get("/api/v2/security/permissions/${permissionName}")
.then()
.extract().response()
}
def deletePermissions(permissionName) {
return given()
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.delete("/api/v2/security/permissions/${permissionName}")
.then()
.extract().response()
}
// Data providers
@DataProvider(name="users")
public Object[][] users() {
return new Object[][]{
["testuser0", "email0@jfrog.com", "password123"],
["testuser1", "email1@jfrog.com", "password123"],
["testuser2", "email2@jfrog.com", "password123"],
["testuser3", "email3@jfrog.com", "password123"],
["testuser4", "email4@jfrog.com", "password123"],
["testuser5", "email5@jfrog.com", "password123"],
["testuser6", "email6@jfrog.com", "password123"],
["testuser7", "email7@jfrog.com", "password123"],
["testuser8", "email8@jfrog.com", "password123"],
["testuser9", "email9@jfrog.com", "password123"]
}
}
@DataProvider(name="groups")
public Object[][] groups() {
return new Object[][]{
["test-group-0"],
["test-group-1"],
["test-group-2"],
["test-group-3"],
["test-group-4"],
["test-group-5"],
["test-group-6"],
["test-group-7"],
["test-group-8"],
["test-group-9"]
}
}
}

View File

@@ -0,0 +1,585 @@
package steps
import org.testng.annotations.DataProvider
import static io.restassured.RestAssured.given
class XraySteps {
def createIssueEvent(issueID, cve, summary, description, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"id\": \"${issueID}\",\n" +
" \"type\": \"Security\",\n" +
" \"provider\": \"JFrog\",\n" +
" \"package_type\": \"maven\",\n" +
" \"severity\": \"High\",\n" +
" \"components\": [\n" +
" {\n" +
" \"id\": \"aero:aero\",\n" +
" \"vulnerable_versions\": [\n" +
" \"[0.2.3]\"\n" +
" ]\n" +
" }\n" +
" ],\n" +
" \"cves\": [\n" +
" {\n" +
" \"cve\": \"${cve}\",\n" +
" \"cvss_v2\": \"2.4\"\n" +
" }\n" +
" ],\n" +
" \"summary\": \"${summary}\",\n" +
" \"description\": \"${description}\",\n" +
" \"sources\": [\n" +
" {\n" +
" \"source_id\": \"${cve}\"\n" +
" }\n" +
" ]\n" +
"}")
.when()
.post("/v1/events")
.then()
.extract().response()
}
def updateIssueEvent(issueID, cve, summary, description, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"type\": \"Security\",\n" +
" \"provider\": \"JFrog\",\n" +
" \"package_type\": \"maven\",\n" +
" \"severity\": \"High\",\n" +
" \"components\": [\n" +
" {\n" +
" \"id\": \"aero:aero\",\n" +
" \"vulnerable_versions\": [\n" +
" \"[0.2.3]\"\n" +
" ]\n" +
" }\n" +
" ],\n" +
" \"cves\": [\n" +
" {\n" +
" \"cve\": \"${cve}\",\n" +
" \"cvss_v2\": \"2.4\"\n" +
" }\n" +
" ],\n" +
" \"summary\": \"${summary}\",\n" +
" \"description\": \"${description}\",\n" +
" \"sources\": [\n" +
" {\n" +
" \"source_id\": \"${cve}\"\n" +
" }\n" +
" ]\n" +
"}")
.when()
.put("/v1/events/${issueID}")
.then()
.extract().response()
}
def createPolicy(policyName, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"name\": \"${policyName}\",\n" +
" \"type\": \"security\",\n" +
" \"description\": \"some description\",\n" +
" \"rules\": [\n" +
" {\n" +
" \"name\": \"securityRule\",\n" +
" \"priority\": 1,\n" +
" \"criteria\": {\n" +
" \"min_severity\": \"High\"\n" +
" },\n" +
" \"actions\": {\n" +
" \"mails\": [\n" +
" \"mail1@example.com\",\n" +
" \"mail2@example.com\"\n" +
" ],\n" +
" \"fail_build\": true,\n" +
" \"block_download\": {\n" +
" \"unscanned\": true,\n" +
" \"active\": true\n" +
" }\n" +
" }\n" +
" }\n" +
" ]\n" +
"}")
.when()
.post("/v1/policies")
.then()
.extract().response()
}
def updatePolicy(policyName, description, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"name\": \"${policyName}\",\n" +
" \"type\": \"security\",\n" +
" \"description\": \"${description}\",\n" +
" \"rules\": [\n" +
" {\n" +
" \"name\": \"securityRule\",\n" +
" \"priority\": 1,\n" +
" \"criteria\": {\n" +
" \"min_severity\": \"High\"\n" +
" },\n" +
" \"actions\": {\n" +
" \"mails\": [\n" +
" \"mail1@example.com\",\n" +
" \"mail2@example.com\"\n" +
" ],\n" +
" \"fail_build\": true,\n" +
" \"block_download\": {\n" +
" \"unscanned\": true,\n" +
" \"active\": true\n" +
" }\n" +
" }\n" +
" }\n" +
" ]\n" +
"}")
.when()
.put("/v1/policies/${policyName}")
.then()
.extract().response()
}
def getPolicy(policyName, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.get("/v1/policies/${policyName}")
.then()
.extract().response()
}
def getPolicies(username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.get("/v1/policies")
.then()
.extract().response()
}
def deletePolicy(policyName, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.delete("/v1/policies/${policyName}")
.then()
.extract().response()
}
def getIssueEvent(issueID, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.get("/v1/events/${issueID}")
.then()
.extract().response()
}
def createWatchEvent(watchName, policyName, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"general_data\": {\n" +
" \"name\": \"${watchName}\",\n" +
" \"description\": \"This is a new watch created using API V2\",\n" +
" \"active\": true\n" +
" },\n" +
" \"project_resources\": {\n" +
" \"resources\": [\n" +
" {\n" +
" \"type\": \"all-repos\",\n" +
" \"filters\": [\n" +
" {\n" +
" \"type\": \"package-type\",\n" +
" \"value\": \"Docker\"\n" +
" },\n" +
" {\n" +
" \"type\": \"package-type\",\n" +
" \"value\": \"Debian\"\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" \"assigned_policies\": [\n" +
" {\n" +
" \"name\": \"${policyName}\",\n" +
" \"type\": \"security\"\n" +
" }\n" +
" ]\n" +
"}")
.when()
.post("/v2/watches")
.then()
.extract().response()
}
def updateWatchEvent(watchName, description, policyName, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"general_data\": {\n" +
" \"name\": \"${watchName}\",\n" +
" \"description\": \"${description}\",\n" +
" \"active\": true\n" +
" },\n" +
" \"project_resources\": {\n" +
" \"resources\": [\n" +
" {\n" +
" \"type\": \"all-repos\",\n" +
" \"filters\": [\n" +
" {\n" +
" \"type\": \"package-type\",\n" +
" \"value\": \"Docker\"\n" +
" },\n" +
" {\n" +
" \"type\": \"package-type\",\n" +
" \"value\": \"Debian\"\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" \"assigned_policies\": [\n" +
" {\n" +
" \"name\": \"${policyName}\",\n" +
" \"type\": \"security\"\n" +
" }\n" +
" ]\n" +
"}")
.when()
.put("/v2/watches/${watchName}")
.then()
.extract().response()
}
def getWatchEvent(watchName, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.get("/v2/watches/${watchName}")
.then()
.extract().response()
}
def deleteWatchEvent(watchName, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.delete("/v2/watches/${watchName}")
.then()
.extract().response()
}
def assignPolicy(watchName, policyName, username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"watches\": [\n" +
" \"${watchName}\"\n" +
" ]\n" +
"}")
.when()
.post("/v1/policies/${policyName}/assign")
.then()
.extract().response()
}
def getIntegrationConfiguration(username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.get("/v1/integration")
.then()
.extract().response()
}
def addtIntegrationConfiguration(username, password, vendorName) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"vendor\": \"${vendorName}\",\n" +
" \"api_key\": \"12345\",\n" +
" \"enabled\": true,\n" +
" \"context\": \"project_id\",\n" +
" \"url\": \"https://saas.whitesourcesoftware.com/xray\",\n" +
" \"description\": \"WhiteSource provides a simple yet powerful open source security and licenses management solution. More details at http://www.whitesourcesoftware.com.\",\n" +
" \"test_url\": \"https://saas.whitesourcesoftware.com/xray/api/checkauth\"\n" +
"}")
.when()
.post("/v1/integration")
.then()
.extract().response()
}
def postSystemParameters(username, password, body) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body(body)
.when()
.put("/v1/configuration/systemParameters")
.then()
.extract().response()
}
def getSystemParameters(username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.get("/v1/configuration/systemParameters")
.then()
.extract().response()
}
def getBinaryManager(username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.get("/v1/binMgr/default")
.then()
.extract().response()
}
def getIndexingConfiguration(username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.when()
.get("/v1/binMgr/default/repos")
.then()
.extract().response()
}
def updateIndexingConfiguration(username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"indexed_repos\": [\n" +
" {\n" +
" \"name\": \"docker-local\",\n" +
" \"type\": \"local\",\n" +
" \"pkg_type\": \"Docker\"\n" +
" },\n" +
" {\n" +
" \"name\": \"generic-dev-local\",\n" +
" \"type\": \"local\",\n" +
" \"pkg_type\": \"Generic\"\n" +
" }\n" +
" ],\n" +
" \"non_indexed_repos\": []\n" +
"}")
.when()
.put("/v1/binMgr/default/repos")
.then()
.extract().response()
}
def startScan(username, password, componentID) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("Content-Type", "application/json")
.body("{\n" +
" \"componentID\": \"${componentID}\"\n" +
"}")
.when()
.post("/v1/scanArtifact")
.then()
.extract().response()
}
def artifactSummary(username, password, artifactPath) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("content-Type", "application/json")
.body("{\n" +
" \"checksums\": [\n" +
" \"\"\n" +
" ],\n" +
" \"paths\": [\n" +
" \"${artifactPath}\"\n" +
" ]\n" +
"}")
.when()
.post("/v1/summary/artifact")
.then()
.extract().response()
}
def createSupportBundle(username, password, name, startDate, endDate) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("Content-Type", "application/json")
.body("{ \n" +
" \"name\":\"${name}\",\n" +
" \"description\":\"desc\",\n" +
" \"parameters\":{ \n" +
" \"configuration\": true,\n" +
" \"system\": true, \n" +
" \"logs\":{ \n" +
" \"include\": true, \n" +
" \"start_date\":\"${startDate}\",\n" +
" \"end_date\":\"${endDate}\"\n" +
" },\n" +
" \"thread_dump\":{ \n" +
" \"count\": 1,\n" +
" \"interval\": 0\n" +
" }\n" +
" }\n" +
"}")
.when()
.post("/v1/system/support/bundle")
.then()
.extract().response()
}
def getSystemMonitoringStatus(username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("Content-Type", "application/json")
.when()
.get("/v1/monitor")
.then()
.extract().response()
}
def xrayPingRequest(username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("Content-Type", "application/json")
.when()
.get("/v1/system/ping")
.then()
.extract().response()
}
def xrayGetVersion(username, password) {
return given()
.auth()
.preemptive()
.basic("${username}", "${password}")
.header("Cache-Control", "no-cache")
.header("Content-Type", "application/json")
.when()
.get("/v1/system/version")
.then()
.extract().response()
}
// Data providers
@DataProvider(name = "issueEvents")
public Object[][] issueEvents() {
return new Object[][]{
["XRAY-", "CVE-2017-2000386", "A very important custom issue", "A very important custom issue"]
}
}
}

View File

@@ -0,0 +1,25 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="All API tests" verbose="1" >
<test name="tests.HealthCheckTest">
<classes>
<class name="tests.HealthCheckTest"/>
</classes>
</test>
<test name="tests.RepositoryTest">
<classes>
<class name="tests.RepositoryTest"/>
</classes>
</test>
<test name="tests.SecurityTest">
<classes>
<class name="tests.SecurityTest"/>
</classes>
</test>
<test name="tests.XrayTest">
<classes>
<class name="tests.XrayTest"/>
</classes>
</test>
</suite>

View File

@@ -0,0 +1,57 @@
package tests
import io.restassured.RestAssured
import io.restassured.path.json.JsonPath
import io.restassured.response.Response
import org.hamcrest.Matchers
import org.testng.Reporter
import org.testng.annotations.BeforeSuite
import org.testng.annotations.Test
import steps.RepositorySteps
import org.yaml.snakeyaml.Yaml
import utils.Shell
class HealthCheckTest extends RepositorySteps{
Yaml yaml = new Yaml()
def configFile = new File("./src/test/resources/testenv.yaml")
def config = yaml.load(configFile.text)
def artifactoryURL
@BeforeSuite(alwaysRun = true)
def setUp() {
artifactoryURL = config.artifactory.external_ip
RestAssured.baseURI = "http://${artifactoryURL}/artifactory"
}
@Test(priority=0, groups="common", testName = "Health check for all 4 services")
void healthCheckTest(){
Response response = getHealthCheckResponse(artifactoryURL)
response.then().assertThat().statusCode(200).
body("router.state", Matchers.equalTo("HEALTHY"))
int bodySize = response.body().jsonPath().getList("services").size()
for (int i = 0; i < bodySize; i++) {
JsonPath jsonPathEvaluator = response.jsonPath()
String serviceID = jsonPathEvaluator.getString("services[" + i + "].service_id")
String nodeID = jsonPathEvaluator.getString("services[" + i + "].node_id")
response.then().
body("services[" + i + "].state", Matchers.equalTo("HEALTHY"))
Reporter.log("- Health check. Service \"" + serviceID + "\" on node \"" + nodeID + "\" is healthy", true)
}
}
@Test(priority=1, groups=["ping","common"], testName = "Ping (In HA 200 only when licences were added)")
void pingTest() {
Response response = ping()
response.then().assertThat().statusCode(200).
body(Matchers.hasToString("OK"))
Reporter.log("- Ping test. Service is OK", true)
}
}

View File

@@ -0,0 +1,302 @@
package tests
import io.restassured.RestAssured
import io.restassured.path.json.JsonPath
import io.restassured.response.Response
import org.hamcrest.Matchers
import org.testng.Reporter
import org.testng.annotations.BeforeTest
import org.testng.annotations.Test
import org.yaml.snakeyaml.Yaml
import steps.RepositorySteps
import java.time.LocalDate
import static org.hamcrest.Matchers.containsString
import static org.hamcrest.Matchers.containsStringIgnoringCase
import static org.hamcrest.Matchers.equalTo
import static org.hamcrest.Matchers.equalToIgnoringCase
import static org.hamcrest.Matchers.greaterThanOrEqualTo
class RepositoryTest extends RepositorySteps{
Yaml yaml = new Yaml()
def configFile = new File("./src/test/resources/testenv.yaml")
def repoListHA = new File("./src/test/resources/repositories/CreateDefault.yaml")
def repoListJCR = new File("./src/test/resources/repositories/CreateJCR.yaml")
def artifact = new File("./src/test/resources/repositories/artifact.zip")
def config = yaml.load(configFile.text)
def artifactoryURL
def username
def password
@BeforeTest(groups=["jcr", "pro"])
def setUp() {
artifactoryURL = config.artifactory.external_ip
username = config.artifactory.rt_username
password = config.artifactory.rt_password
RestAssured.baseURI = "http://${artifactoryURL}/artifactory"
RestAssured.authentication = RestAssured.basic(username, password);
RestAssured.useRelaxedHTTPSValidation();
}
@Test(priority=1, groups=["pro"], testName = "Delete sample repositories")
void deleteReposTest(){
Response getRepoResponse = getRepos()
JsonPath jsonPathEvaluator = getRepoResponse.jsonPath()
List<String> repoNames = jsonPathEvaluator.getList("key", String.class)
for (int i = 0; i < repoNames.size(); i ++){
Response delete = deleteRepository(repoNames[i], username, password)
delete.then().statusCode(200)
}
Reporter.log("- Delete sample HA repositories. All repositories were successfully deleted", true)
}
@Test(priority=1, groups=["jcr",], testName = "Delete sample repositories JCR")
void deleteDefaultJCRReposTest(){
Response getRepoResponse = getRepos()
JsonPath jsonPathEvaluator = getRepoResponse.jsonPath()
List<String> repoNames = jsonPathEvaluator.getList("key", String.class)
for (int i = 0; i < repoNames.size(); i ++){
Response delete = deleteRepository(repoNames[i], username, password)
delete.then().statusCode(400).body("errors[0].message",
containsStringIgnoringCase("This REST API is available only in Artifactory Pro"))
}
Reporter.log("- Delete sample JCR repositories. " +
"Verified - this REST API is available only in Artifactory Pro", true)
}
@Test(priority=2, groups=["pro"], testName = "Create a list of repositories for HA, specified in YAML file")
void createDefaultHAReposTest(){
def body
def expectedMessage
body = repoListHA
expectedMessage = "383 changes to config merged successfully"
Response response = createRepositories(body, username, password)
response.then().assertThat().statusCode(200)
.body(Matchers.hasToString(expectedMessage))
.log().body()
Reporter.log("- Create repositories for HA distribution. Successfully created", true)
}
@Test(priority=2, groups=["jcr"], testName = "Create a list of repositories for JCR, specified in YAML file")
void createDefaultJCRReposTest(){
def body
def expectedMessage
body = repoListJCR
expectedMessage = "82 changes to config merged successfully"
Response response = createRepositories(body, username, password)
response.then().assertThat().statusCode(200)
.body(Matchers.hasToString(expectedMessage))
.log().body()
Reporter.log("- Create repositories for JCR. Successfully created", true)
}
@Test(priority=3, groups=["pro"], testName = "Verify HA repositories were created successfully")
void checkDefaultHAReposTest(){
Response response = getRepos()
def numberOfRepos = response.then().extract().path("size()")
def expectedReposNumber = 84
println("Number of created repositories is ${numberOfRepos}")
response.then().assertThat().statusCode(200)
.body("size()", greaterThanOrEqualTo(expectedReposNumber))
Reporter.log("- Verify HA repos were created. ${numberOfRepos} repositories were created", true)
}
@Test(priority=3, groups=["jcr"], testName = "Verify JCR repositories were created successfully")
void checkDefaultJCRReposTest(){
Response response = getRepos()
def numberOfRepos = response.then().extract().path("size()")
def expectedReposNumber = 17
response.then().assertThat().statusCode(200)
.body("size()", greaterThanOrEqualTo(expectedReposNumber))
Reporter.log("- Verify JCR repos were created. ${numberOfRepos} repositories were created", true)
}
@Test(priority=4, groups=["jcr","pro"], testName = "Create a directory in generic repo")
void createDirectoryTest(){
def repoName = "generic-dev-local"
def directoryName = "test-directory/"
Response response = createDirectory(repoName, directoryName)
response.then().assertThat().statusCode(201)
.body("repo", equalTo(repoName))
.body("path", equalTo("/" + directoryName))
.body("uri", equalTo("http://" + artifactoryURL + ":80/artifactory/" + repoName + "/" + directoryName))
Reporter.log("- Create folder. Folder successfully created", true)
}
@Test(priority=5, groups=["jcr","pro"], testName = "Deploy file to generic repo")
void deployArtifactToGenericTest(){
def repoName = "generic-dev-local"
def directoryName = "test-directory"
def filename = "artifact.zip"
Response response = deployArtifact(repoName, directoryName, artifact, filename)
response.then().assertThat().statusCode(201)
.body("repo", equalTo(repoName))
.body("path", equalTo("/" + directoryName + "/" + filename))
.body("downloadUri", equalTo("http://" + artifactoryURL + ":80/artifactory/" + repoName + "/"
+ directoryName + "/" + filename))
Reporter.log("- Deploy artifact. Artifact successfully deployed", true)
}
@Test(priority=6, groups=["jcr", "pro"], testName = "Get the artifact info")
void getArtifactinfoTest(){
def repoName = "generic-dev-local"
def directoryName = "test-directory"
def filename = "artifact.zip"
Response response = getInfo(repoName, directoryName, artifact, filename)
response.then().assertThat().statusCode(200)
.body("repo", equalTo(repoName))
.body("path", equalTo("/" + directoryName + "/" + filename))
.body("downloadUri", equalTo("http://" + artifactoryURL + ":80/artifactory/" + repoName + "/"
+ directoryName + "/" + filename))
Reporter.log("- Get the artifact info. Artifact info is successfully returned", true)
}
@Test(priority=7, groups=["jcr", "pro"], testName = "Delete item")
void deleteJCRItemTest(){
def repoName = "generic-dev-local"
def directoryName = "test-directory"
def filename = "artifact.zip"
Response response = deleteItem(repoName, directoryName, artifact, filename)
response.then().assertThat().statusCode(204)
Response verification = getInfo(repoName, directoryName, artifact, filename)
verification.then().statusCode(404)
.body("errors[0].message", equalToIgnoringCase("Unable to find item"))
Reporter.log("- Delete item. File has been deleted successfully", true)
}
@Test(priority=8, groups=["pro"], testName = "Create support bundle")
void createSupportBundleHATest(){
def name = "Support Bundle"
LocalDate startDate = LocalDate.now().minusDays(5)
LocalDate endDate = LocalDate.now()
Response response = createSupportBundle(name, startDate, endDate)
response.then().assertThat().statusCode(200)
.body("artifactory.bundle_url", containsString(artifactoryURL))
Reporter.log("- Create support bundle. Successfully created", true)
}
@Test(priority=8, groups=["jcr"], testName = "Create support bundle")
void createSupportBundleJCATest(){
def name = "Support Bundle"
LocalDate startDate = LocalDate.now().minusDays(5)
LocalDate endDate = LocalDate.now()
Response response = createSupportBundle(name, startDate, endDate)
response.then().assertThat().statusCode(400)
.body("errors[0].message",
containsStringIgnoringCase("This REST API is available only in Artifactory Pro"))
Reporter.log("- Create support bundle, JCR. " +
"Call is not supported in JCR version, error message is correct", true)
}
@Test(priority=9, groups=["pro"], testName = "Delete created repositories")
void deleteDefaultReposTest(){
Response getRepoResponse = getRepos()
JsonPath jsonPathEvaluator = getRepoResponse.jsonPath()
List<String> repoNames = jsonPathEvaluator.getList("key", String.class)
for (int i = 0; i < repoNames.size(); i ++){
Response delete = deleteRepository(repoNames[i], username, password)
delete.then().statusCode(200)
}
Reporter.log("- Delete HA repositories. All repositories were successfully deleted", true)
}
@Test(priority=9, groups=["jcr",], testName = "Delete sample repositories JCR")
void deleteJCRReposTest(){
Response getRepoResponse = getRepos()
JsonPath jsonPathEvaluator = getRepoResponse.jsonPath()
List<String> repoNames = jsonPathEvaluator.getList("key", String.class)
for (int i = 0; i < repoNames.size(); i ++){
Response delete = deleteRepository(repoNames[i], username, password)
delete.then().statusCode(400).body("errors[0].message",
containsStringIgnoringCase("This REST API is available only in Artifactory Pro"))
}
Reporter.log("- Delete sample JCR repositories. All repositories were successfully deleted", true)
}
@Test(priority=10, groups=["pro"], testName = "Verify repositories were deleted successfully")
void checkReposAreDeleted(){
Response response = getRepos()
def numberOfRepos = response.then().extract().path("size()")
def expectedReposNumber = 0
response.then().assertThat().statusCode(200)
.body("size()", equalTo(expectedReposNumber))
Reporter.log("- Verify repo were deleted. ${numberOfRepos} repositories remain", true)
}
@Test(priority=11, groups=["pro"], testName = "Re-Create a list of repositories, for the next tests")
void reCreateDefaultHAReposTest(){
def body
def expectedMessage
body = repoListHA
expectedMessage = "383 changes to config merged successfully"
Response response = createRepositories(body, username, password)
response.then().assertThat().statusCode(200)
.body(Matchers.hasToString(expectedMessage))
.log().body()
Reporter.log("- Re-create repositories for HA distribution. Successfully created", true)
}
@Test(priority=12, groups=["jcr"], testName = "Re-Create a list of repositories, for the next tests")
void reCreateDefaultJCRReposTest(){
def body
def expectedMessage
body = repoListJCR
expectedMessage = "82 changes to config merged successfully"
Response response = createRepositories(body, username, password)
response.then().assertThat().statusCode(200)
.body(Matchers.hasToString(expectedMessage))
.log().body()
Reporter.log("- Re-create repositories for JCR distribution. Successfully created", true)
}
@Test(priority=13, groups=["jcr","pro"], testName = "Create a directory in generic repo")
void reCreateDirectoryTest(){
def repoName = "generic-dev-local"
def directoryName = "test-directory/"
Response response = createDirectory(repoName, directoryName)
response.then().assertThat().statusCode(201)
.body("repo", equalTo(repoName))
.body("path", equalTo("/" + directoryName))
.body("uri", equalTo("http://" + artifactoryURL + ":80/artifactory/" + repoName + "/" + directoryName))
Reporter.log("- Create folder. Folder successfully created", true)
}
@Test(priority=14, groups=["jcr","pro"], testName = "Deploy file to generic repo")
void reDeployArtifactToGenericTest(){
def repoName = "generic-dev-local"
def directoryName = "test-directory"
def filename = "artifact.zip"
Response response = deployArtifact(repoName, directoryName, artifact, filename)
response.then().assertThat().statusCode(201)
.body("repo", equalTo(repoName))
.body("path", equalTo("/" + directoryName + "/" + filename))
.body("downloadUri", equalTo("http://" + artifactoryURL + ":80/artifactory/" + repoName + "/"
+ directoryName + "/" + filename))
Reporter.log("- Deploy artifact. Artifact successfully deployed", true)
}
}

View File

@@ -0,0 +1,153 @@
package tests
import io.restassured.RestAssured
import io.restassured.response.Response
import org.hamcrest.Matchers
import org.junit.Assert
import org.testng.Reporter
import org.testng.annotations.BeforeSuite
import org.testng.annotations.Test
import org.yaml.snakeyaml.Yaml
import steps.SecuritytSteps
class SecurityTest extends SecuritytSteps{
Yaml yaml = new Yaml()
def configFile = new File("./src/test/resources/testenv.yaml")
def config = yaml.load(configFile.text)
def artifactoryURL
def distribution
def username
def password
@BeforeSuite(groups=["jcr","pro"])
def setUp() {
artifactoryURL = config.artifactory.external_ip
distribution = config.artifactory.distribution
username = config.artifactory.rt_username
password = config.artifactory.rt_password
RestAssured.baseURI = "http://${artifactoryURL}/artifactory"
RestAssured.authentication = RestAssured.basic(username, password);
RestAssured.useRelaxedHTTPSValidation();
}
@Test(priority=1, groups=["pro"], dataProvider = "users", testName = "Create users")
void createUsersTest(usernameRt, emailRt, passwordRt){
Response response = createUser(usernameRt, emailRt, passwordRt)
response.then().statusCode(201)
Reporter.log("- Create users. User ${usernameRt} created successfully", true)
}
@Test(priority=2, groups=["pro"], dataProvider = "users", testName = "Verify users were created successfully")
void verifyUsersTest(usernameRt, emailRt, passwordRt){
Response response = getUserDetails(usernameRt)
response.then().statusCode(200).
body("name", Matchers.equalTo(usernameRt)).
body("email", Matchers.equalTo(emailRt)).
body("admin", Matchers.equalTo(false)).
body("groups[0]", Matchers.equalTo("readers"))
Reporter.log("- Verify created users. User ${usernameRt} was successfully verified", true)
}
@Test(priority=3, groups=["pro"], dataProvider = "users", testName = "Generate API keys")
void generateAPIKeysTest(usernameRt, emailRt, passwordRt) {
Response createKey = generateAPIKey(usernameRt, passwordRt)
def errorMessage = createKey.then().extract().path("error")
if (errorMessage == null) {
def key = createKey.then().extract().path("apiKey")
Response getKey = getAPIKey(usernameRt, passwordRt)
def keyVerification = getKey.then().extract().path("apiKey")
Assert.assertTrue(key == keyVerification)
Reporter.log("- Generate API keys. Key for ${usernameRt} created successfully", true)
} else if (errorMessage.toString().contains("Api key already exists for user:")){
Reporter.log("- Generate API keys. Key for ${usernameRt} already exists, skipped", true)
}
}
@Test(priority=4, groups=["pro"], dataProvider = "users", testName = "Re-generate API keys")
void regenerateAPIKeysTest(usernameRt, emailRt, passwordRt){
Response regenerated = regenerateAPIKey(usernameRt, passwordRt)
regenerated.then().statusCode(200)
def key = regenerated.then().extract().path("apiKey")
Response getKey = getAPIKey(usernameRt, passwordRt)
getKey.then().statusCode(200)
def keyVerification = getKey.then().extract().path("apiKey")
Assert.assertTrue(key == keyVerification)
Reporter.log("- Re-generate API keys. Key for ${usernameRt} re-generated successfully", true)
}
@Test(priority=5, groups=["pro"], dataProvider = "groups", testName = "Create a group")
void createGroupTest(groupName){
Response create = createGroup(groupName)
create.then().statusCode(201)
Response get = getGroup(groupName)
get.then().statusCode(200)
def name = get.then().extract().path("name")
def adminPrivileges = get.then().extract().path("adminPrivileges")
Assert.assertTrue(name == groupName)
Assert.assertTrue(adminPrivileges == false)
Reporter.log("- Create group. Group ${groupName} was successfully created", true)
}
@Test(priority=6, groups=["pro"], testName = "Create and verify permissions")
void createPermissionsTest(){
def permissionName = "testPermission"
def repository = "ANY"
def user1 = "testuser0"
def user2 = "testuser1"
def group1 = "test-group-0"
def group2 = "test-group-1"
def action1 = "read"
def action2 = "write"
def action3 = "manage"
Response create = createPermissions(permissionName, repository, user1, user2,
group1, group2, action1, action2, action3)
create.then().statusCode(200)
Response get = getPermissions(permissionName)
get.then().statusCode(200)
Assert.assertTrue(permissionName == get.then().extract().path("name"))
Assert.assertTrue(repository == get.then().extract().path("repo.repositories[0]"))
Assert.assertTrue(action1 == get.then().extract().path("repo.actions.users.${user1}[0]"))
Assert.assertTrue(action2 == get.then().extract().path("repo.actions.users.${user1}[1]"))
Assert.assertTrue(action3 == get.then().extract().path("repo.actions.users.${user1}[2]"))
Assert.assertTrue(action1 == get.then().extract().path("repo.actions.users.${user2}[0]"))
Assert.assertTrue(action2 == get.then().extract().path("repo.actions.users.${user2}[1]"))
Assert.assertTrue(action3 == get.then().extract().path("repo.actions.users.${user2}[2]"))
Assert.assertTrue(action1 == get.then().extract().path("repo.actions.groups.${group1}[0]"))
Assert.assertTrue(action2 == get.then().extract().path("repo.actions.groups.${group2}[1]"))
Assert.assertTrue(action1 == get.then().extract().path("repo.actions.groups.${group2}[0]"))
Assert.assertTrue(action2 == get.then().extract().path("repo.actions.groups.${group2}[1]"))
Reporter.log("- Create permissions. Permissions successfully created and verified", true)
}
@Test(priority=7, groups=["pro"], testName = "Delete permissions")
void deletePermissionsTest(){
def permissionName = "testPermission"
Response delete = deletePermissions(permissionName)
delete.then().statusCode(200)
Reporter.log("- Delete permissions. User ${permissionName} has been removed successfully", true)
}
@Test(priority=8, groups=["pro"], dataProvider = "users", testName = "Delete non-default users")
void deleteUserTest(usernameRt, email, passwordRt){
Response delete = deleteUser(usernameRt)
delete.then().statusCode(200).body(Matchers.containsString("${usernameRt}"))
Reporter.log("- Delete user. User ${usernameRt} has been removed successfully", true)
}
@Test(priority=9, groups=["pro"], dataProvider = "groups", testName = "Delete non-default groups")
void deleteGroupTest(groupName){
Response delete = deleteGroup(groupName)
delete.then().statusCode(200).body(Matchers.containsString("${groupName}"))
Reporter.log("- Delete group. Group ${groupName} has been removed successfully", true)
}
}

View File

@@ -0,0 +1,332 @@
package tests
import io.restassured.RestAssured
import io.restassured.response.Response
import org.testng.Assert
import org.testng.Reporter
import org.testng.annotations.BeforeSuite
import org.testng.annotations.BeforeTest
import org.testng.annotations.Test
import org.yaml.snakeyaml.Yaml
import steps.XraySteps
import java.time.LocalDate
import static org.hamcrest.Matchers.containsStringIgnoringCase
import static org.hamcrest.Matchers.emptyArray
import static org.hamcrest.Matchers.equalTo
import static org.hamcrest.Matchers.hasItem
import static org.hamcrest.Matchers.is
import static org.hamcrest.Matchers.isA
import static org.hamcrest.Matchers.not
import static org.hamcrest.Matchers.notNullValue
import static org.hamcrest.Matchers.nullValue
class XrayTest extends XraySteps{
Yaml yaml = new Yaml()
def configFile = new File("./src/test/resources/testenv.yaml")
def config = yaml.load(configFile.text)
def artifactoryURL
def distribution
def username
def password
def randomIndex
def policyName
def watchName
@BeforeSuite(groups=["xray"])
def setUp() {
artifactoryURL = config.artifactory.external_ip
distribution = config.artifactory.distribution
username = config.artifactory.rt_username
password = config.artifactory.rt_password
RestAssured.authentication = RestAssured.basic(username, password)
RestAssured.useRelaxedHTTPSValidation()
Random random = new Random()
randomIndex = random.nextInt(10000000)
policyName = "security_policy_${randomIndex}"
watchName = "all-repositories_${randomIndex}"
}
@BeforeTest(groups=["xray"])
def testSetUp() {
RestAssured.baseURI = "http://${artifactoryURL}/xray/api"
}
@Test(priority=1, groups=["xray"], dataProvider = "issueEvents", testName = "Create Issue Event")
void createIssueEventTest(issueID, cve, summary, description){
Response create = createIssueEvent(issueID+randomIndex, cve, summary, description, username, password)
create.then().statusCode(201)
Response get = getIssueEvent(issueID+randomIndex, username, password)
get.then().statusCode(200)
def issueIDverification = get.then().extract().path("id")
def cveVerification = get.then().extract().path("source_id")
def summaryVerification = get.then().extract().path("summary")
def descriptionVerification = get.then().extract().path("description")
Assert.assertTrue(issueID+randomIndex == issueIDverification)
Assert.assertTrue(cve == cveVerification)
Assert.assertTrue(summary == summaryVerification)
Assert.assertTrue(description == descriptionVerification)
Reporter.log("- Create issue event. Issue event with ID ${issueID+randomIndex} created and verified successfully", true)
}
@Test(priority=2, groups=["xray"], dataProvider = "issueEvents", testName = "Update Issue Event",
dependsOnMethods = "createIssueEventTest")
void updateIssueEventTest(issueID, cve, summary, description){
cve = "CVE-2017-0000000"
summary = "Updated"
description = "Updated"
Response update = updateIssueEvent(issueID+randomIndex, cve, summary, description, username, password)
update.then().statusCode(200)
Response get = getIssueEvent(issueID+randomIndex, username, password)
get.then().statusCode(200)
def cveVerification = get.then().extract().path("source_id")
def summaryVerification = get.then().extract().path("summary")
def descriptionVerification = get.then().extract().path("description")
Assert.assertTrue(cve == cveVerification)
Assert.assertTrue(summary == summaryVerification)
Assert.assertTrue(description == descriptionVerification)
Reporter.log("- Update issue event. Issue event with ID ${issueID+randomIndex} updated and verified successfully", true)
}
@Test(priority=3, groups=["xray"], testName = "Create policy")
void createPolicyTest(){
Response create = createPolicy(policyName, username, password)
create.then().statusCode(201)
Response get = getPolicy(policyName, username, password)
get.then().statusCode(200)
def policyNameVerification = get.then().extract().path("name")
Assert.assertTrue(policyName == policyNameVerification)
Reporter.log("- Create policy. Policy with name ${policyName} created and verified successfully", true)
}
@Test(priority=4, groups=["xray"], testName = "Update policy", dependsOnMethods = "createPolicyTest")
void updatePolicyTest(){
def description = "Updated description"
Response update = updatePolicy(policyName, description, username, password)
update.then().statusCode(200)
Response get = getPolicy(policyName, username, password)
get.then().statusCode(200)
def descriptionVerification = get.then().extract().path("description")
Assert.assertTrue(description == descriptionVerification)
Reporter.log("- Update policy. Policy with name ${policyName} updated and verified successfully", true)
}
@Test(priority=4, groups=["xray"], testName = "Get policies")
void getPoliciesTest(){
Response response = getPolicies(username, password)
response.then().statusCode(200)
.body("name", notNullValue())
.body("type", notNullValue())
.body("description", notNullValue())
.body("author", notNullValue())
.body("rules", notNullValue())
.body("created", notNullValue())
.body("modified", notNullValue())
def policies = response.then().extract().path("name")
Reporter.log("- Get policies. Policies list is returned successfully. " +
"Policies returned: ${policies}", true)
}
@Test(priority=5, groups=["xray"], testName = "Create watch for the repositories", dependsOnMethods = "createPolicyTest")
void createWatchTest(){
Response create = createWatchEvent(watchName, policyName, username, password)
create.then().statusCode(201)
.body("info",
equalTo("Watch has been successfully created"))
Response get = getWatchEvent(watchName, username, password)
get.then().statusCode(200)
.body("general_data.name", equalTo((watchName).toString()))
Reporter.log("- Create watch. Watch with name ${watchName} has been created and verified successfully", true)
}
@Test(priority=6, groups=["xray"], testName = "Update watch for the repositories", dependsOnMethods = "createWatchTest")
void updateWatchTest(){
def description = "Updated watch"
Response create = updateWatchEvent(watchName, description, policyName, username, password)
create.then().statusCode(200)
.body("info",
equalTo("Watch was successfully updated"))
Response get = getWatchEvent(watchName, username, password)
get.then().statusCode(200)
.body("general_data.description", equalTo(description))
Reporter.log("- Update watch. Watch with name ${watchName} has been updated and verified successfully", true)
}
@Test(priority=7, groups=["xray"], testName = "Assign policy to watches")
void assignPolicyToWatchTest(){
Response response = assignPolicy(watchName, policyName, username, password)
response.then().statusCode(200)
.body("result.${watchName}",
equalTo("Policy assigned successfully to Watch"))
Reporter.log("- Assign policy to watch. Policy assigned successfully to Watch", true)
}
@Test(priority=8, groups=["xray"], testName = "Delete watch")
void deleteWatchTest(){
Response response = deleteWatchEvent(watchName, username, password)
response.then().statusCode(200)
.body("info",
equalTo("Watch was deleted successfully"))
Reporter.log("- Delete watch. Watch ${watchName} has been successfully deleted", true)
}
@Test(priority=9, groups=["xray"], testName = "Delete policy")
void deletePolicyTest(){
Response response = deletePolicy(policyName, username, password)
response.then().statusCode(200)
.body("info",
equalTo(("Policy ${policyName} was deleted successfully").toString()))
Reporter.log("- Delete policy. Policy ${policyName} has been successfully deleted", true)
}
/* @Test(priority=10, groups=["xray"], testName = "Start scan")
void startScanTest(){
def artifactPath = "default/generic-dev-local/test-directory/artifact.zip"
Response getSha = artifactSummary(username, password, artifactPath)
def componentID = getSha.then().extract().path("artifacts[0].licenses[0].components[0]")
Response scan = startScan(username, password, componentID)
scan.then().statusCode(200)
.body("info",
equalTo(("Scan of artifact is in progress").toString()))
Reporter.log("- Start scan. Scan of ${componentID} has been started successfully", true)
}*/
@Test(priority=11, groups=["xray"], testName = "Create and get integration configuration")
void integrationConfigurationTest(){
def vendorName = "vendor_${randomIndex}"
Response post = addtIntegrationConfiguration(username, password, vendorName)
post.then().statusCode(200)
Response get = getIntegrationConfiguration(username, password)
int bodySize = get.body().jsonPath().getList(".").size()
get.then().statusCode(200)
.body("[" + (bodySize-1) + "].vendor", equalTo(vendorName.toString()))
Reporter.log("- Integration configuration. " +
"Configuration for vendor ${vendorName} has been successfully added and verified", true)
}
@Test(priority=12, groups=["xray"], testName = "Enable TLS for RabbitMQ")
void enableTLSRabbitMQTest(){
File body = new File("./src/test/resources/enableRabbitMQ.json")
Response post = postSystemParameters(username, password, body)
post.then().statusCode(200)
Response get = getSystemParameters(username, password)
get.then().statusCode(200).body("enableTlsConnectionToRabbitMQ", equalTo(true))
Reporter.log("- Enable TLS for RabbitMQ. TLS for RabbitMQ has been successfully enabled and verified", true)
}
@Test(priority=13, groups=["xray"], testName = "Get binary manager")
void getBinaryManagerTest(){
Response response = getBinaryManager(username, password)
response.then().statusCode(200)
.body("binMgrId", equalTo("default"))
.body("license_valid", equalTo(true))
.body("binMgrId", equalTo("default"))
def version = response.then().extract().path("version")
Reporter.log("- Get binary manager. Binary manager is verified, connected RT version: ${version}", true)
}
@Test(priority=14, groups=["xray"], testName = "Get repo indexing configuration")
void getIndexingConfigurationTest(){
Response response = getIndexingConfiguration(username, password)
response.then().statusCode(200)
.body("bin_mgr_id", equalTo("default"))
.body("indexed_repos.name", hasItem("generic-dev-local"))
Reporter.log("- Get repo indexing configuration.", true)
}
@Test(priority=15, groups=["xray"], testName = "Update repo indexing configuration")
void updateIndexingConfigurationTest(){
Response response = updateIndexingConfiguration(username, password)
response.then().statusCode(200)
.body("info", equalTo("Repositories list has been successfully sent to Artifactory"))
Reporter.log("- Update repo indexing configuration. Successfully updated", true)
}
// Force reindex test, add in latest versions of X-ray
/* @Test(priority=16, groups=["xray"], testName = "Get artifact summary")
void artifactSummaryTest(){
def artifactPath = "default/generic-dev-local/test-directory/artifact.zip"
Response post = artifactSummary(username, password, artifactPath)
post.then().statusCode(200)
.body("artifacts[0].general.path", equalTo(artifactPath))
Reporter.log("- Get artifact summary. Artifact summary has been returned successfully", true)
}*/
@Test(priority=17, groups=["xray"], testName = "Create support bundle")
void createSupportBundleTest(){
def name = "Support Bundle"
LocalDate startDate = LocalDate.now().minusDays(5)
LocalDate endDate = LocalDate.now()
Response response = createSupportBundle(username, password, name, startDate, endDate)
def bundle_url = response.then().extract().path("artifactory.bundle_url")
if ((bundle_url.toString()).contains(artifactoryURL)) {
Reporter.log("- Create support bundle. Successfully created using X-ray API", true)
} else if (((bundle_url.toString()).contains("localhost"))){
Reporter.log("- Create support bundle. Created with a bug, localhost instead of the hostname", true)
}
}
@Test(priority=18, groups=["xray"], testName = "Get system monitoring status")
void getSystemMonitoringTest(){
Response response = getSystemMonitoringStatus(username, password)
response.then().statusCode(200)
Reporter.log("- Get system monitoring status. Data returned successfully", true)
}
@Test(priority=19, groups=["xray"], testName = "X-ray ping request")
void xrayPingRequestTest(){
Response response = xrayPingRequest(username, password)
response.then().statusCode(200)
.body("status", equalTo("pong"))
Reporter.log("- Get system monitoring status. Data returned successfully", true)
}
@Test(priority=20, groups=["xray"], testName = "X-ray version")
void xrayGetVersionTest(){
Response response = xrayGetVersion(username, password)
response.then().statusCode(200)
.body("xray_version", notNullValue())
.body("xray_revision", notNullValue())
def version = response.then().extract().path("xray_version")
def revision = response.then().extract().path("xray_revision")
Reporter.log("- Get X-ray version. Version: ${version}, revision: ${revision}", true)
}
}

View File

@@ -0,0 +1,19 @@
package utils
class ConfigurationUtil {
static def getEnvironmentVariableValue(def name) {
def value = System.getProperty(name)
if (value == null) {
value = System.getenv(name)
if (value == null) {
throw new Exception("Environment variable $name not set!");
}
}
return value
}
}

View File

@@ -0,0 +1,81 @@
package utils
import utils.ProcessOutputStream
/**
* Created by eliom on 6/19/18.
*/
class DSL {
/**
* Run shell command
*/
static def sh = { command, outputBuffer = null, folder = null, silent = false, customEnvVariables = null, errorBuffer = null ->
//def workdir = ConfigurationUtil.getEnvironmentVariableValue("KERMIT_WORKSPACE_DIR")
def workdir = "/Users/danielmi/projects/soldev/.kermit-workspace"
def commandFolder
if (folder != null) {
commandFolder = new File(folder, workdir)
} else {
commandFolder = workdir
}
if (!silent) {
println "Running command at ${commandFolder}: $command"
}
def proc = null
try {
def env = System.getenv().collect { k, v -> "$k=$v" }
if (customEnvVariables != null) {
env.addAll( customEnvVariables.collect { k, v -> "$k=$v" })
}
if (command instanceof List && command.size() > 0 && command[0] instanceof List) {
//Pipe Commands
command.each {
if (proc != null) {
proc = proc | it.execute(env, commandFolder)
} else {
proc = it.execute(env, commandFolder)
}
}
} else {
proc = command.execute(env, commandFolder)
}
} catch (IOException e) {
println "Failed to execute command: ${e.getMessage()}"
return -1
}
def processOutput = new ProcessOutputStream(silent, outputBuffer == null)
def errorOutput = processOutput
if (errorBuffer != null) {
errorOutput = new ProcessOutputStream(silent, errorBuffer == null)
}
proc.consumeProcessOutput(processOutput, errorOutput)
def exitStatus = proc.waitFor()
if (!silent) {
println "Exit: $exitStatus"
}
if (outputBuffer != null) {
outputBuffer.append(processOutput.toString())
}
processOutput.close()
if (errorBuffer != null) {
errorBuffer.append(errorOutput.toString())
errorOutput.close()
}
return exitStatus
}
//...
}

View File

@@ -0,0 +1,10 @@
package utils
class EnvironmentConfig {
}

View File

@@ -0,0 +1,32 @@
package utils
public class ProcessOutputStream extends ByteArrayOutputStream{
private boolean silent = false;
private boolean discardOutput = false;
public ProcessOutputStream(boolean silent, boolean discardOutput) {
this.silent = silent;
this.discardOutput = discardOutput;
}
@Override
public synchronized void write(int b) {
if (!silent) {
System.out.write(b);
}
if (!discardOutput) {
super.write(b);
}
}
@Override
public synchronized void write(byte[] b, int off, int len) {
if (!silent) {
System.out.write(b, off, len);
}
if (!discardOutput) {
super.write(b, off, len);
}
}
}

View File

@@ -0,0 +1,17 @@
package utils
class Shell {
def executeProc(cmd) {
println(cmd)
def proc = cmd.execute()
proc.in.eachLine {line ->
println line
}
println proc.err.text
proc.exitValue()
}
}

View File

@@ -0,0 +1,32 @@
package utils
/**
* Created by eliom on 6/26/18.
*/
class WorkspaceManager {
//TODO: Make it Thread safe
def static currentPath = []
def static pushPath(path) {
currentPath.push(path)
}
def static popPath() {
currentPath.pop()
}
def static getCurrentDir() {
def workspaceRoot = ConfigurationUtil.getWorkspaceDir()
if (currentPath.size() > 0) {
def currentDir = new File(currentPath.join('/'), workspaceRoot)
if (!currentDir.exists()) {
currentDir.mkdirs()
}
return currentDir
} else {
return workspaceRoot
}
}
}

View File

@@ -0,0 +1,11 @@
{
"sslInsecure": false,
"maxDiskDataUsage": 80,
"monitorSamplingInterval": 300,
"mailNoSsl": false,
"messageMaxTTL": 7,
"jobInterval": 86400,
"allowSendingAnalytics": true,
"httpsPort": 443,
"enableTlsConnectionToRabbitMQ": true
}

View File

@@ -0,0 +1,9 @@
{
"vendor": "whitesource5",
"api_key": "12345",
"enabled": true,
"context": "project_id",
"url": "https://saas.whitesourcesoftware.com/xray",
"description": "WhiteSource provides a simple yet powerful open source security and licenses management solution. More details at http://www.whitesourcesoftware.com.",
"test_url": "https://saas.whitesourcesoftware.com/xray/api/checkauth"
}

View File

@@ -0,0 +1,554 @@
localRepositories:
libs-release-local:
type: maven
description: "production deployment"
repoLayout: maven-2-default
xray:
enabled: true
libs-snapshot-local:
type: maven
description: "snapshot deployment"
repoLayout: maven-2-default
xray:
enabled: true
maven-prod-local:
type: maven
description: "production release deployment"
repoLayout: maven-2-default
xray:
enabled: true
maven-dev-local:
type: maven
description: "development release deployment"
repoLayout: maven-2-default
xray:
enabled: true
maven-release-local:
type: maven
description: "development release deployment"
repoLayout: maven-2-default
xray:
enabled: true
maven-snapshot-local:
type: maven
description: "development release deployment"
repoLayout: maven-2-default
xray:
enabled: true
gradle-prod-local:
type: gradle
description: "production deployment"
repoLayout: gradle-default
xray:
enabled: true
gradle-dev-local:
type: gradle
description: "development deployment"
repoLayout: gradle-default
xray:
enabled: true
tomcat-local:
type: generic
description: "used by demo"
repoLayout: simple-default
xray:
enabled: true
generic-prod-local:
type: generic
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
generic-dev-local:
type: generic
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
ivy-prod-local:
type: ivy
description: "production deployment"
repoLayout: "ivy-default"
xray:
enabled: true
ivy-dev-local:
type: ivy
description: "development deployment"
repoLayout: ivy-default
xray:
enabled: true
helm-prod-local:
type: helm
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
helm-dev-local:
type: helm
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
sbt-prod-local:
type: sbt
description: "production deployment"
repoLayout: sbt-default
xray:
enabled: true
sbt-dev-local:
type: sbt
description: "development deployment"
repoLayout: sbt-default
xray:
enabled: true
nuget-prod-local:
type: nuget
description: "production deployment"
repoLayout: nuget-default
xray:
enabled: true
nuget-dev-local:
type: nuget
description: "development deployment"
repoLayout: nuget-default
xray:
enabled: true
gems-prod-local:
type: gems
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
gems-dev-local:
type: gems
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
npm-prod-local:
type: npm
description: "production deployment"
repoLayout: npm-default
xray:
enabled: true
npm-dev-local:
type: npm
description: "development deployment"
repoLayout: npm-default
xray:
enabled: true
bower-prod-local:
type: bower
description: "production deployment"
repoLayout: bower-default
xray:
enabled: true
bower-dev-local:
type: bower
description: "development deployment"
repoLayout: bower-default
xray:
enabled: true
debian-prod-local:
type: debian
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
debian-dev-local:
type: debian
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
php-prod-local:
type: composer
description: "production deployment"
repoLayout: composer-default
xray:
enabled: true
php-dev-local:
type: composer
description: "development deployment"
repoLayout: composer-default
xray:
enabled: true
pypi-prod-local:
type: pypi
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
pypi-dev-local:
type: pypi
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
docker-prod-local:
type: docker
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
docker-stage-local:
type: docker
description: "stage deployment"
repoLayout: simple-default
xray:
enabled: true
docker-dev-local:
type: docker
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
docker-local:
type: docker
description: "docker deployment"
repoLayout: simple-default
xray:
enabled: true
docker-push:
type: docker
description: "docker push repo for push replication testing"
repoLayout: simple-default
xray:
enabled: true
vagrant-prod-local:
type: vagrant
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
vagrant-dev-local:
type: vagrant
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
gitlfs-prod-local:
type: gitlfs
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
gitlfs-dev-local:
type: gitlfs
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
rpm-prod-local:
type: yum
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
rpm-dev-local:
type: yum
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
conan-prod-local:
type: conan
description: "production deployment"
repoLayout: conan-default
xray:
enabled: true
conan-dev-local:
type: conan
description: "development deployment"
repoLayout: conan-default
xray:
enabled: true
chef-prod-local:
type: chef
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
chef-dev-local:
type: chef
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
puppet-prod-local:
type: puppet
description: "production deployment"
repoLayout: puppet-default
xray:
enabled: true
puppet-dev-local:
type: puppet
description: "development deployment"
repoLayout: puppet-default
xray:
enabled: true
go-prod-local:
type: go
description: "production deployment"
repoLayout: go-default
xray:
enabled: true
go-staging-local:
type: go
description: "production deployment"
repoLayout: go-default
xray:
enabled: true
remoteRepositories:
docker-remote:
type: docker
url: https://registry-1.docker.io
repoLayout: simple-default
enableTokenAuthentication: true
xray:
enabled: true
helm-remote:
type: helm
url: https://storage.googleapis.com/kubernetes-charts
repoLayout: simple-default
xray:
enabled: true
jcenter:
type: maven
url: https://jcenter.bintray.com
repoLayout: maven-2-default
xray:
enabled: true
npm-remote:
type: npm
url: https://registry.npmjs.org
repoLayout: npm-default
xray:
enabled: true
nuget-remote:
type: nuget
url: https://www.nuget.org/
repoLayout: nuget-default
xray:
enabled: true
bower-remote:
type: bower
url: https://github.com/
repoLayout: bower-default
xray:
enabled: true
gems-remote:
type: gems
url: https://rubygems.org/
repoLayout: simple-default
xray:
enabled: true
debian-remote:
type: debian
url: http://archive.ubuntu.com/ubuntu/
repoLayout: simple-default
xray:
enabled: true
php-remote:
type: composer
url: https://github.com/
repoLayout: composer-default
xray:
enabled: true
pypi-remote:
type: pypi
url: https://files.pythonhosted.org
repoLayout: simple-default
xray:
enabled: true
rpm-remote:
type: yum
url: http://mirror.centos.org/centos/
repoLayout: simple-default
xray:
enabled: true
chef-remote:
type: chef
url: https://supermarket.chef.io
repoLayout: simple-default
xray:
enabled: true
puppet-remote:
type: puppet
url: https://forgeapi.puppetlabs.com/
repoLayout: puppet-default
xray:
enabled: true
virtualRepositories:
maven-release-virtual:
type: maven
repositories:
- maven-prod-local
- jcenter
- maven-release-local
- libs-release-local
description: "maven release virtual repositories"
defaultDeploymentRepo: maven-release-local
maven-snapshot-virtual:
type: maven
repositories:
- maven-snapshot-local
- jcenter
- maven-dev-local
- libs-snapshot-local
description: "maven snapshot virtual repositories"
defaultDeploymentRepo: maven-snapshot-local
gradle-virtual:
type: gradle
repositories:
- gradle-dev-local
- jcenter
- gradle-prod-local
- libs-release-local
description: "gradle virtual repositories"
defaultDeploymentRepo: gradle-dev-local
docker-PLACEHOLDERFORBUILDSTEP:
type: docker
repositories:
- docker-local
- docker-remote
- docker-dev-local
- docker-prod-local
- docker-stage-local
- docker-push
description: "docker virtual"
defaultDeploymentRepo: docker-stage-local
docker-virtual:
type: docker
repositories:
- docker-local
- docker-remote
- docker-dev-local
- docker-prod-local
- docker-stage-local
- docker-push
description: "docker virtual"
defaultDeploymentRepo: docker-stage-local
libs-release:
type: maven
repositories:
- libs-release-local
- jcenter
description: "maven libraries virtual"
defaultDeploymentRepo: libs-release-local
libs-snapshot:
type: maven
repositories:
- libs-snapshot-local
- jcenter
description: "maven libraries virtual"
defaultDeploymentRepo: libs-snapshot-local
ivy-virtual:
type: ivy
repositories:
- ivy-prod-local
- ivy-dev-local
- jcenter
description: "ivy virtual"
defaultDeploymentRepo: ivy-dev-local
generic-virtual:
type: generic
repositories:
- generic-prod-local
- generic-dev-local
description: "generic virtual"
defaultDeploymentRepo: generic-dev-local
helm-virtual:
type: helm
repositories:
- helm-prod-local
- helm-dev-local
- helm-remote
description: "helm virtual"
defaultDeploymentRepo: helm-dev-local
nuget-virtual:
type: nuget
repositories:
- nuget-prod-local
- nuget-dev-local
- nuget-remote
description: "nuget virtual"
defaultDeploymentRepo: nuget-dev-local
npm-virtual:
type: npm
repositories:
- npm-dev-local
- npm-remote
- npm-prod-local
description: "npm virtual"
defaultDeploymentRepo: npm-dev-local
chef-virtual:
type: chef
repositories:
- chef-dev-local
- chef-remote
- chef-prod-local
description: "chef virtual"
defaultDeploymentRepo: chef-dev-local
puppet-virtual:
type: puppet
repositories:
- puppet-dev-local
- puppet-remote
- puppet-prod-local
description: "puppet virtual"
defaultDeploymentRepo: puppet-dev-local
rpm-virtual:
type: yum
repositories:
- rpm-dev-local
- rpm-remote
- rpm-prod-local
description: "rpm virtual"
defaultDeploymentRepo: rpm-dev-local
gitlfs-virtual:
type: gitlfs
repositories:
- gitlfs-dev-local
- gitlfs-prod-local
description: "gitlfs virtual"
defaultDeploymentRepo: gitlfs-dev-local
pypi-virtual:
type: pypi
repositories:
- pypi-dev-local
- pypi-prod-local
- pypi-remote
description: "pypi virtual"
defaultDeploymentRepo: pypi-dev-local
bower-virtual:
type: bower
repositories:
- bower-dev-local
- bower-prod-local
- bower-remote
description: "bower virtual"
defaultDeploymentRepo: bower-dev-local
gems-virtual:
type: gems
repositories:
- gems-dev-local
- gems-prod-local
- gems-remote
description: "gems virtual"
defaultDeploymentRepo: gems-dev-local
sbt-virtual:
type: sbt
repositories:
- sbt-dev-local
- sbt-prod-local
- jcenter
description: "sbt virtual"
defaultDeploymentRepo: sbt-dev-local
go-staging:
type: go
repositories:
- go-staging-local
- go-prod-local
description: "go virtual"
defaultDeploymentRepo: go-staging-local

View File

@@ -0,0 +1,119 @@
localRepositories:
tomcat-local:
type: generic
description: "used by demo"
repoLayout: simple-default
xray:
enabled: true
generic-prod-local:
type: generic
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
generic-dev-local:
type: generic
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
helm-prod-local:
type: helm
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
helm-dev-local:
type: helm
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
docker-generator:
type: docker
description: "docker generator repo for generation testing"
repoLayout: simple-default
xray:
enabled: true
docker-prod-local:
type: docker
description: "production deployment"
repoLayout: simple-default
xray:
enabled: true
docker-stage-local:
type: docker
description: "stage deployment"
repoLayout: simple-default
xray:
enabled: true
docker-dev-local:
type: docker
description: "development deployment"
repoLayout: simple-default
xray:
enabled: true
docker-local:
type: docker
description: "docker deployment"
repoLayout: simple-default
xray:
enabled: true
docker-push:
type: docker
description: "docker push repo for push replication testing"
repoLayout: simple-default
xray:
enabled: true
virtualRepositories:
generic-virtual:
type: generic
repositories:
- generic-prod-local
- generic-dev-local
description: "generic virtual"
defaultDeploymentRepo: generic-dev-local
helm-virtual:
type: helm
repositories:
- helm-prod-local
- helm-dev-local
- helm-remote
description: "helm virtual"
defaultDeploymentRepo: helm-dev-local
docker-PLACEHOLDERFORBUILDSTEP:
type: docker
repositories:
- docker-local
- docker-remote
- docker-dev-local
- docker-prod-local
- docker-stage-local
- docker-push
description: "docker virtual"
defaultDeploymentRepo: docker-stage-local
docker-virtual:
type: docker
repositories:
- docker-local
- docker-remote
- docker-dev-local
- docker-prod-local
- docker-stage-local
- docker-push
description: "docker virtual"
defaultDeploymentRepo: docker-stage-local
remoteRepositories:
helm-remote:
type: helm
url: https://storage.googleapis.com/kubernetes-charts
repoLayout: simple-default
xray:
enabled: true
docker-remote:
type: docker
url: https://registry-1.docker.io
repoLayout: simple-default
enableTokenAuthentication: true
xray:
enabled: true

View File

@@ -0,0 +1,6 @@
artifactory:
url: urlval
external_ip: ipval
distribution: artifactory_ha
rt_username: admin
rt_password: passval