-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add buildkite pipeline to build test and scan images
- Loading branch information
Showing
3 changed files
with
158 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,124 @@ | ||
definitions: | ||
steps: | ||
- step: &test-agents | ||
agents: | ||
provider: "gcp" | ||
machineType: "n1-standard-8" | ||
useVault: true | ||
image: family/enterprise-search-ubuntu-2204-connectors-py | ||
retries: &retries | ||
retry: | ||
automatic: | ||
- exit_status: -1 # Connection to the Agent was lost | ||
signal_reason: none | ||
limit: 2 | ||
- exit_status: 255 # Timeout | ||
signal_reason: none | ||
limit: 2 | ||
- exit_status: 2 # Flaky test | ||
signal_reason: none | ||
limit: 2 | ||
|
||
steps: | ||
- group: ":truck: Building, Testing and Scanning Dockerfile and Dockerfile.ftest" | ||
key: "build_test_scan_group" | ||
if: "(build.branch == \"main\")" | ||
steps: | ||
# ---- | ||
# Dockerfile build and tests on amd64 | ||
# ---- | ||
- label: "Build amd64 image from Dockerfile" | ||
agents: | ||
provider: aws | ||
instanceType: m6i.xlarge | ||
imagePrefix: ci-amazonlinux-2 | ||
env: | ||
ARCHITECTURE: "amd64" | ||
DOCKERFILE_PATH: "Dockerfile" | ||
DOCKER_IMAGE_NAME: "docker.elastic.co/ci-agent-images/elastic-connectors-dockerfile" | ||
DOCKER_ARTIFACT_KEY: "elastic-connectors-dockerfile" | ||
command: ".buildkite/publish/build-docker.sh" | ||
key: "build_dockerfile_image_amd64" | ||
artifact_paths: ".artifacts/*.tar.gz" | ||
- label: "Test amd64 image built from Dockerfile" | ||
agents: | ||
provider: aws | ||
instanceType: m6i.xlarge | ||
imagePrefix: ci-amazonlinux-2 | ||
env: | ||
ARCHITECTURE: "amd64" | ||
DOCKERFILE_PATH: "Dockerfile" | ||
DOCKER_IMAGE_NAME: "docker.elastic.co/ci-agent-images/elastic-connectors-dockerfile" | ||
DOCKER_ARTIFACT_KEY: "elastic-connectors-dockerfile" | ||
depends_on: "build_dockerfile_image_amd64" | ||
key: "test_dockerfile_image_amd64" | ||
commands: | ||
- "mkdir -p .artifacts" | ||
- buildkite-agent artifact download '.artifacts/*.tar.gz*' .artifacts/ --step build_dockerfile_image_amd64 | ||
- ".buildkite/publish/test-docker.sh" | ||
|
||
# ---- | ||
# Dockerfile.ftest build and tests on amd64 | ||
# ---- | ||
- label: "Build amd64 image from Dockerfile.ftest" | ||
agents: | ||
provider: aws | ||
instanceType: m6i.xlarge | ||
imagePrefix: ci-amazonlinux-2 | ||
env: | ||
ARCHITECTURE: "amd64" | ||
DOCKERFILE_PATH: "Dockerfile.ftest" | ||
DOCKER_IMAGE_NAME: "docker.elastic.co/ci-agent-images/elastic-connectors-dockerfile-ftest" | ||
DOCKER_ARTIFACT_KEY: "elastic-connectors-dockerfile-ftest" | ||
command: ".buildkite/publish/build-docker.sh" | ||
key: "build_dockerfile_ftest_image_amd64" | ||
artifact_paths: ".artifacts/*.tar.gz" | ||
- label: "Test amd64 image built from Dockerfile.ftest" | ||
agents: | ||
provider: aws | ||
instanceType: m6i.xlarge | ||
imagePrefix: ci-amazonlinux-2 | ||
env: | ||
ARCHITECTURE: "amd64" | ||
DOCKERFILE_PATH: "Dockerfile.ftest" | ||
DOCKER_IMAGE_NAME: "docker.elastic.co/ci-agent-images/elastic-connectors-dockerfile-ftest" | ||
DOCKER_ARTIFACT_KEY: "elastic-connectors-dockerfile-ftest" | ||
depends_on: "build_dockerfile_ftest_image_amd64" | ||
key: "test_dockerfile_ftest_image_amd64" | ||
commands: | ||
- "mkdir -p .artifacts" | ||
- buildkite-agent artifact download '.artifacts/*.tar.gz*' .artifacts/ --step build_dockerfile_ftest_image_amd64 | ||
- ".buildkite/publish/test-docker.sh" | ||
|
||
|
||
# ---- | ||
# Vulnerability scanning on Dockerfile and Dockerfile.ftest built images | ||
# ---- | ||
- label: "Trivy Scan amd64 Dockerfile Artifacts" | ||
timeout_in_minutes: 10 | ||
depends_on: | ||
- test_dockerfile_image_amd64 | ||
key: "trivy-scan-dockerfile-image" | ||
agents: | ||
provider: k8s | ||
image: "docker.elastic.co/ci-agent-images/trivy:latest" | ||
command: |- | ||
mkdir -p .artifacts | ||
buildkite-agent artifact download '.artifacts/*.tar.gz*' .artifacts/ --step build_dockerfile_image_amd64 | ||
trivy --version | ||
env | grep TRIVY | ||
find .artifacts -type f -name '*.tar.gz*' -exec trivy image --quiet --input {} \; | ||
- label: "Trivy Scan amd64 Dockerfile.ftest Artifacts" | ||
timeout_in_minutes: 10 | ||
depends_on: | ||
- test_dockerfile_ftest_image_amd64 | ||
key: "trivy-scan-dockerfile-ftest-image" | ||
agents: | ||
provider: k8s | ||
image: "docker.elastic.co/ci-agent-images/trivy:latest" | ||
command: |- | ||
mkdir -p release | ||
buildkite-agent artifact download '.artifacts/*.tar.gz*' .artifacts/ --step build_dockerfile_ftest_image_amd64 | ||
trivy --version | ||
env | grep TRIVY | ||
find .artifacts -type f -name '*.tar.gz*' -exec trivy image --quiet --input {} \; |
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