-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dakar updates on course 4
- Loading branch information
Showing
11 changed files
with
211 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ log-rest.log | |
|
||
common/**/.jfrog** | ||
.DS_Store | ||
course-1/tf-init/tf-plan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "<UPDATE>", | ||
"type": "security", | ||
"author": "admin", | ||
"rules": [ | ||
{ | ||
"name": "critical", | ||
"priority": 1, | ||
"actions": { | ||
"block_download": { | ||
"unscanned": true, | ||
"active": true | ||
} | ||
}, | ||
"criteria": { | ||
"fix_version_dependant": false, | ||
"malicious_package": false, | ||
"min_severity": "Critical" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"general_data": { | ||
"name": "<UPDATE>", | ||
"description": "This is a new watch created using API V2", | ||
"active": true | ||
}, | ||
"project_resources": { | ||
"resources": [ | ||
{ | ||
"type": "repository", | ||
"name": "<UPDATE>", | ||
"bin_mgr_id": "default", | ||
"repo_type": "local" | ||
} | ||
] | ||
}, | ||
"assigned_policies": [ | ||
{ | ||
"name": "<UPDATE>", | ||
"type": "security" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#/bin/bash | ||
|
||
if [ ! -z "$1" ]; then | ||
echo "[ERROR] No JFrog Project key " | ||
fi | ||
|
||
|
||
cd ../../common/java | ||
|
||
MY_PROJ_KEY="" | ||
MY_IMAGE="${JFROG_SAAS_DNS}/${MY_PROJ_KEY}-docker/java-app:1.0.0" | ||
|
||
echo "*****************************" | ||
echo "**** SCAN DEPENDENCIES" | ||
echo "*****************************" | ||
|
||
# scan dependencies before the build | ||
jf audit --watches CI --fail=false | ||
|
||
echo "*****************************" | ||
echo "**** BUILD APP" | ||
echo "*****************************" | ||
|
||
# build app | ||
mvn clean package deploy | ||
|
||
echo "*****************************" | ||
echo "**** CONTAINERIZE APP" | ||
echo "*****************************" | ||
|
||
# containerize app | ||
docker build \ | ||
-t $MY_IMAGE \ | ||
--build-arg REGISTRY=${JFROG_SAAS_DNS} \ | ||
--build-arg DOCKER_REPO=${MY_PROJ_KEY}-docker \ | ||
. | ||
|
||
echo "*****************************" | ||
echo "**** SCAN CONTAINER IMAGE" | ||
echo "*****************************" | ||
|
||
# scan all the layers of the generated image (including the base image's layers) | ||
jf docker scan $MY_IMAGE --fail=false | ||
|
||
echo "*****************************" | ||
echo "**** PUSH IMAGE TO ARTIFACTORY" | ||
echo "*****************************" | ||
|
||
docker push $MY_IMAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#/bin/bash | ||
|
||
cd ../../common/java | ||
|
||
MY_PROJ_KEY="" | ||
MY_IMAGE="${JFROG_SAAS_DNS}/${MY_PROJ_KEY}-docker/java-app:1.0.0" | ||
export JFROG_CLI_BUILD_NAME=${MY_PROJ_KEY}-app \ | ||
JFROG_CLI_BUILD_NUMBER=1 \ | ||
JFROG_CLI_BUILD_URL="https://myCI.com" | ||
# export JFROG_CLI_BUILD_PROJECT=${MY_PROJ_KEY} | ||
|
||
echo "*****************************" | ||
echo "**** CONFIG JFROG CLI" | ||
echo "*****************************" | ||
|
||
jf mvnc \ | ||
--repo-deploy-releases ${MY_PROJ_KEY}-maven \ | ||
--repo-deploy-snapshots ${MY_PROJ_KEY}-maven \ | ||
--repo-resolve-releases ${MY_PROJ_KEY}-maven \ | ||
--repo-resolve-snapshots ${MY_PROJ_KEY}-maven | ||
|
||
# result of the mvnc instruction | ||
# cat .jfrog/projects/maven.yaml | ||
|
||
echo "*****************************" | ||
echo "**** SCAN DEPENDENCIES" | ||
echo "*****************************" | ||
|
||
# scan dependencies before the build | ||
jf audit --watches CI --fail=false | ||
|
||
echo "*****************************" | ||
echo "**** BUILD APP" | ||
echo "*****************************" | ||
|
||
# build app + deploy + generate Application Build Info | ||
jf mvn clean package deploy | ||
|
||
# publish Application Build Info | ||
jf bp | ||
|
||
echo "*****************************" | ||
echo "**** CONTAINERIZE APP" | ||
echo "*****************************" | ||
|
||
# containerize app | ||
docker build \ | ||
-t $MY_IMAGE \ | ||
--build-arg REGISTRY=${JFROG_SAAS_DNS} \ | ||
--build-arg DOCKER_REPO=${MY_PROJ_KEY}-docker \ | ||
. | ||
|
||
echo "*****************************" | ||
echo "**** SCAN CONTAINER IMAGE" | ||
echo "*****************************" | ||
|
||
# scan the layers of the base image | ||
jf docker scan $MY_IMAGE --fail=false | ||
|
||
echo "*****************************" | ||
echo "**** PUSH IMAGE TO ARTIFACTORY WITH BUILD INFO" | ||
echo "*****************************" | ||
|
||
docker push $MY_IMAGE --build-name="${JFROG_CLI_BUILD_NAME}-container" --build-number=${JFROG_CLI_BUILD_NUMBER} | ||
|
||
# add application as a dependeny of the Container Build Info | ||
jf bad "./target/*.war" "${JFROG_CLI_BUILD_NAME}-container" ${JFROG_CLI_BUILD_NUMBER} | ||
|
||
# publish Container Build Info | ||
jf bp "${JFROG_CLI_BUILD_NAME}-container" ${JFROG_CLI_BUILD_NUMBER} |