Files
alertmanager-discord/.circleci/config.yml
T
Iain Sproat f79a6754f5 chore(circleci): update remote docker to prevent 'brownout' (#36)
* chore(circleci): update remote docker to prevent 'brownout'

* Update packages
2024-05-28 16:13:24 +01:00

162 lines
4.4 KiB
YAML

version: 2.1
workflows:
build-image:
jobs:
- get-version:
filters:
tags: &filter-allow-all
only: /.*/
- pre-commit:
filters:
tags: *filter-allow-all
- docker-build:
filters:
tags: &filter-ignore-all
ignore: /.*/
branches:
ignore:
- main
requires:
- get-version
- docker-build-and-publish:
context:
- docker-hub
filters:
tags: *filter-allow-all
branches:
only:
- main
requires:
- get-version
- pre-commit
- helm-package-and-publish:
filters:
tags: *filter-allow-all
branches:
only:
- main
requires:
- docker-build
- docker-build-and-publish
jobs:
get-version:
docker: &docker-image
- image: cimg/base:2024.01
working_directory: &workingdir /tmp/ci
steps:
- checkout
- run: mkdir -p workspace
- run:
name: set version
command: |
echo "export VERSION=$(.circleci/get_version.sh)" >> workspace/env-vars
- run:
name: store version
command: |
cat workspace/env-vars >> $BASH_ENV
- run:
name: echo version
command: |
echo "VERSION=${VERSION}"
- persist_to_workspace:
root: workspace
paths:
- env-vars
pre-commit:
parameters:
config_file:
default: ./.pre-commit-config.yaml
description: Optional, path to pre-commit config file.
type: string
cache_prefix:
default: ""
description: |
Optional cache prefix to be used on CircleCI. Can be used for cache busting or to ensure multiple jobs use different caches.
type: string
docker:
- image: speckle/pre-commit-runner:latest
resource_class: &docker-resource-class medium
working_directory: *workingdir
steps:
- checkout
- restore_cache:
keys:
- cache-pre-commit-<<parameters.cache_prefix>>-{{ checksum "<<parameters.config_file>>" }}
- run:
name: Install pre-commit hooks
command: pre-commit install-hooks --config <<parameters.config_file>>
- save_cache:
key: cache-pre-commit-<<parameters.cache_prefix>>-{{ checksum "<<parameters.config_file>>" }}
paths:
- ~/.cache/pre-commit
- run:
name: Run pre-commit
command: pre-commit run --all-files --config <<parameters.config_file>>
- run:
command: git --no-pager diff
name: git diff
when: on_fail
docker-build-and-publish:
docker: *docker-image
resource_class: *docker-resource-class
working_directory: *workingdir
steps:
- checkout
- attach_workspace:
at: /tmp/ci/workspace
- run:
name: populate environment variables
command: |
cat workspace/env-vars >> $BASH_ENV
- setup_remote_docker: &remote-docker
version: default
docker_layer_caching: true
- run:
name: Build and Publish
command: ./.circleci/build.sh && ./.circleci/publish.sh
docker-build:
docker: *docker-image
resource_class: *docker-resource-class
working_directory: *workingdir
steps:
- checkout
- attach_workspace:
at: /tmp/ci/workspace
- run:
name: populate environment variables
command: |
cat workspace/env-vars >> $BASH_ENV
- setup_remote_docker: *remote-docker
- run:
name: Build
command: ./.circleci/build.sh
helm-package-and-publish:
docker:
- image: quay.io/helmpack/chart-testing:v3.10.1-amd64
resource_class: *docker-resource-class
working_directory: *workingdir
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "30:cb:bf:0c:ec:3b:fe:88:6c:be:af:b3:d1:36:75:db"
- attach_workspace:
at: /tmp/workspace
- run:
name: populate environment variables
command: |
cat /tmp/workspace/env-vars >> $BASH_ENV
- run:
name: Build and Publish
command: ./.circleci/package_and_publish_helm.sh