Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added codefresh template #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Codefresh/codefresh-container-image-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# More examples of Codefresh YAML can be found at
# https://codefresh.io/docs/docs/yaml-examples/examples/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, no report artefacts are generated. I suggest we go without first and setup a GH issue on this repo to showcase static HTML reports like these https://codefresh.io/docs/docs/testing/test-reports/ (via snyk-to-html)


version: "1.0"
# Stages can help you organize your steps in stages
stages:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider setting up a "security" stage and showcase the 4 snyk products in a task each, so code, open source, container+image, iac

https://codefresh.io/docs/docs/codefresh-yaml/stages/

- "prepare"
- "verify"
- "deploy"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this stage is declared but not used below, I suggest to remove it


steps:
main_clone:
title: "Cloning repository"
type: "git-clone"
repo: "codefresh-contrib/unlimited-test-environments-source-code"
revision: "${{CF_REVISION}}"
stage: "prepare"

run_unit_tests:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to run unit tests for these examples, let's focus solely on the steps required for getting snyk tests to work (also, the mvn invocation does not run tests, but calls package - which compiles the app)

title: Compile/Unit test
stage: prepare
image: 'maven:3.5.2-jdk-8-alpine'
commands:
- mvn -Dmaven.repo.local=/codefresh/volume/m2_repository package
build_app_image:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after the docker image is built, it is not used in the below stages

  1. either we skip this step
  2. or we pass the built image name to the security.container step, for example (security stage to be done)

title: Building Docker Image
type: build
stage: prepare
image_name: kostiscodefresh/spring-actuator-sample-app
working_directory: ./
tag: '${{CF_BRANCH}}'
dockerfile: Dockerfile

# Snyk scan starts here from a SNYK CLI image

scan_code:
title: Source security scan
stage: verify
image: 'snyk/snyk-cli:maven-3.6.3_java11'
commands:
- snyk monitor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this command needs a token & authentication - where is it handled?