Skip to content

Instantly share code, notes, and snippets.

@trevjonez
Created August 31, 2022 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trevjonez/682c5341ae9b91db2cb4c4e26fba06c7 to your computer and use it in GitHub Desktop.
Save trevjonez/682c5341ae9b91db2cb4c4e26fba06c7 to your computer and use it in GitHub Desktop.
cci dynamic config example
# .circleci/config.yml
# https://discuss.circleci.com/t/intro-to-dynamic-config-via-setup-workflows/39868
version: 2.1
setup: true
orbs:
continuation: circleci/continuation@0.3.1
executors:
ubuntu-vm:
machine:
image: ubuntu-2204:current
docker_layer_caching: false
commands:
external_script:
description: Run a shell script as a run step. Writing bash can be challenging, this command lets you do it in a standalone file to enable A better IDE/tooling experience.
parameters:
arguments:
default: ""
description: inlined within double quoted eval argument, be mindful when using double quotes
type: string
background:
default: false
type: boolean
file_name:
type: string
no_output_timeout:
default: 10m
type: string
step_name:
type: string
when:
default: on_success
description: one of [on_success, on_fail, always]
type: string
steps:
- run:
background: <<parameters.background>>
command: |
echo "Executing script: <<parameters.file_name>>"
chmod +x <<parameters.file_name>>
eval "<<parameters.file_name>> <<parameters.arguments>>"
name: <<parameters.step_name>>
no_output_timeout: <<parameters.no_output_timeout>>
when: <<parameters.when>>
jobs:
setup:
executor: ubuntu-vm
steps:
- checkout
- external_script:
step_name: "Install circleci cli"
file_name: ".circleci/scripts/installCircleCli.sh"
- run:
name: Generate config
command: |
echo "TODO: invoke your build tool or other script to generate the required elements for your"
./cci_cli config pack .circleci/main > .circleci/main.yml
./cci_cli config validate .circleci/main.yml
- store_artifacts:
path: "./.circleci/main.yml"
- continuation/continue:
configuration_path: .circleci/main.yml
workflows:
setup:
jobs:
- setup
#!/bin/bash -eux
# .circleci/scripts/installCircleCli.sh
DESTDIR="$(pwd)/cci_cli"
export DESTDIR
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | bash
./cci_cli version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment