-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding 1.0.1 libs to be used by docker-scan (#2700)
* Adding 1.0.1 libs to be used by docker-scan Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> * Tweak comments Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
- Loading branch information
1 parent
3d5bd99
commit 1778b73
Showing
9 changed files
with
56 additions
and
119 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
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,31 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
|
||
import jenkins.tests.BuildPipelineTest | ||
import org.junit.Before | ||
import org.junit.Test | ||
import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library | ||
import static com.lesfurets.jenkins.unit.global.lib.GitSource.gitSource | ||
|
||
class TestDockerScanJob extends BuildPipelineTest { | ||
|
||
@Override | ||
@Before | ||
void setUp() { | ||
|
||
super.setUp() | ||
|
||
// Variables | ||
binding.setVariable('IMAGE_FULL_NAME', 'alpine:3') | ||
|
||
} | ||
|
||
@Test | ||
void DockerScan_test() { | ||
super.testPipeline('jenkins/docker/docker-scan.jenkinsfile', | ||
'tests/jenkins/jenkinsjob-regression-files/docker/docker-scan.jenkinsfile') | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
...-regression-files/docker/docker-copy-testCopyContainerDockerProdtoEcrProd.jenkinsfile.txt
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
...ssion-files/docker/docker-copy-testCopyContainerDockerStagingToDockerProd.jenkinsfile.txt
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
...gression-files/docker/docker-copy-testCopyContainerDockerStagingToEcrProd.jenkinsfile.txt
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
...ssion-files/docker/docker-copy-testCopyContainerDockerStagingtoEcrStaging.jenkinsfile.txt
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
...gression-files/docker/docker-copy-testCopyContainerECRStagingtoDockerProd.jenkinsfile.txt
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
...-regression-files/docker/docker-copy-testCopyContainerEcrStagingtoEcrProd.jenkinsfile.txt
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
tests/jenkins/jenkinsjob-regression-files/docker/docker-scan.jenkinsfile.txt
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,24 @@ | ||
docker-scan.run() | ||
docker-scan.modernSCM({$class=GitSCMSource, remote=https://github.com/opensearch-project/opensearch-build-libraries.git}) | ||
docker-scan.library({identifier=jenkins@1.0.1, retriever=null}) | ||
docker-scan.pipeline(groovy.lang.Closure) | ||
docker-scan.timeout({time=30}) | ||
docker-scan.echo(Executing on agent [label:none]) | ||
docker-scan.stage(Parameters Check, groovy.lang.Closure) | ||
docker-scan.script(groovy.lang.Closure) | ||
docker-scan.stage(Scan Images, groovy.lang.Closure) | ||
docker-scan.script(groovy.lang.Closure) | ||
docker-scan.scanDockerImage({imageFullName=alpine:3, imageResultFile=scan_docker_image}) | ||
scanDockerImage.sh( | ||
touch scan_docker_image.txt scan_docker_image.json | ||
trivy image --clear-cache | ||
docker rmi `docker images -f "dangling=true" -q` || echo | ||
docker rmi alpine:3 || echo | ||
trivy image --format table --output scan_docker_image.txt alpine:3 | ||
trivy image --format json --output scan_docker_image.json alpine:3 | ||
) | ||
docker-scan.archiveArtifacts({artifacts=scan_docker_image.*}) | ||
docker-scan.script(groovy.lang.Closure) | ||
docker-scan.postCleanup() | ||
postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true}) | ||
docker-scan.sh(trivy image --clear-cache) |