codefreshArchived
11 messages
Michal Matyjekabout 5 years ago(edited)
conditional execution of Codefresh steps based on files modified pattern?
For monorepos - seems like nothing out of the box that would allow us to execute specific steps only if specific files get modified. For example run stepA, stepB if files in serviceA/* were modifed, but do not run these steps if files in serviceB/* were modified.
Got some good suggestions from Codefresh on scripting this, but wondering if anyone else hit this/has a step ready?
For monorepos - seems like nothing out of the box that would allow us to execute specific steps only if specific files get modified. For example run stepA, stepB if files in serviceA/* were modifed, but do not run these steps if files in serviceB/* were modified.
Got some good suggestions from Codefresh on scripting this, but wondering if anyone else hit this/has a step ready?
Erik Osterman (Cloud Posse)about 5 years ago
We've released our GitHub action for managing codefresh pipelines: https://github.com/cloudposse/actions/tree/master/codefresh/pipeline-creator
Erik Osterman (Cloud Posse)about 5 years ago
this allows for centralized management of pipelines so that individual repos only need to specify a single action referencing a catalog of pipelines (E.g. a
microservice catalog, an spa catalog, etc)Erik Osterman (Cloud Posse)about 5 years ago
name: codefresh
on:
push:
branches:
- main
paths:
# When this file is merged to the default branch, then perform codefresh CRUD
- '.github/workflows/codefresh.yml'
# Synchronize pipelines with Codefresh nightly
schedule:
- cron: '0 0 * * *'
jobs:
pipeline-creator:
runs-on: ubuntu-latest
steps:
- uses: cloudposse/actions/codefresh/pipeline-creator@0.25.0
with:
# GitHub owner and repository name of the application repository
repo: "${{ github.repository }}"
# Codefresh project name to host the pipelines
cf_project: "${{ github.event.repository.name }}"
# URL of the repository that contains Codefresh pipelines and pipeline specs
cf_repo_url: "<https://github.com/cloudposse/codefresh.git>"
# Version of the repository that contains Codefresh pipelines and pipeline specs
cf_repo_version: "0.1.0"
# Pipeline spec type (microservice, spa, serverless)
cf_spec_type: "microservice"
# A comma separated list of pipeline specs to create the pipelines from
cf_specs: "preview,build,deploy,release,destroy"
env:
GITHUB_USER: "xxxxxxxxx-bot"
# Global organization secrets
GITHUB_TOKEN: "${{ secrets.CF_GITHUB_TOKEN }}"
CF_API_KEY: "${{ secrets.CF_API_KEY }}"Erik Osterman (Cloud Posse)about 5 years ago
@dustinvb ☝️
Erik Osterman (Cloud Posse)about 5 years ago
Also, here's a sample catalog of pipelines for a kubernetes microservice (that we use) https://github.com/cloudposse/codefresh/tree/main/specs/microservice
dustinvbabout 5 years ago
This is excellent! ☝️ We've got other ways of doing this through GLOB expressions on file changes but this is pretty cool approach as well very dynamic way to generate pipelines with little recoding. I do have to ask though are you seeing more desire for this over our 1 to many pipeline to GIT projects capabilities. I've been working with most prospects and we often make 3 common pipelines. 1 to programmatically update the pipeline other 2 (CI/CD) and GIT Projects associated. I am going to invite our Codefresh TAM working in this area to the channel here to review what you've put together.
dustinvbabout 5 years ago
@Laurent Rochette See above.
Erik Osterman (Cloud Posse)about 5 years ago
dustinvbabout 5 years ago
@Erik Osterman (Cloud Posse) Appreciate the attention you brought to Codefresh
! Let me know if we can ever help out with things.
I am sure you're already aware but we're committed to maintaining the following Terraform provider for Codefresh.
https://github.com/codefresh-io/terraform-provider-codefresh
! Let me know if we can ever help out with things.I am sure you're already aware but we're committed to maintaining the following Terraform provider for Codefresh.
https://github.com/codefresh-io/terraform-provider-codefresh
Michal Matyjekabout 5 years ago
trying to figure out array merging with yaml anchors in codefresh.yml
this should work, I think:
but codefresh validate fails with:
this should work, I think:
indicators:
- environment:
&aws_regions
AWS=us-east-1,us-east-2,us-west-2
steps:
test:
environment:
- *aws_regions
- CLUSTER=us-1-westbut codefresh validate fails with:
"0" must be a string. Current value: [object Object]