This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
static/pipeline.yml

154 lines
3.5 KiB
YAML
Raw Normal View History

2023-05-26 07:28:00 +00:00
---
2023-05-26 21:37:23 +00:00
resource_types:
- name: apprise
type: registry-image
source:
2023-07-05 21:39:07 +00:00
repository: git.kun.is/pim/concourse-apprise-notifier
2023-06-14 20:15:56 +00:00
tag: "1.1.1"
2023-05-26 07:28:00 +00:00
2023-05-19 22:19:33 +00:00
resources:
- name: site-repo
type: git
source:
2023-07-05 21:39:07 +00:00
uri: https://git.kun.is/pim/static.git
2023-05-26 07:49:12 +00:00
icon: git
2023-05-19 22:19:33 +00:00
- name: site-registry-image
type: registry-image
source:
2023-07-05 21:39:07 +00:00
repository: git.kun.is/pim/static
2023-05-19 22:19:33 +00:00
username: pim
password: ((api_key))
2023-06-14 20:08:03 +00:00
tag: stable
2023-05-26 07:49:12 +00:00
icon: docker
2023-05-26 21:37:23 +00:00
- name: apprise-notification
type: apprise
source:
2023-07-12 17:59:07 +00:00
host: https://apprise.kun.is:444
2023-05-26 21:37:23 +00:00
key: concourse
icon: bell
2023-06-14 18:55:42 +00:00
- name: version
type: semver
source:
driver: git
initial_version: "1.1.0"
2023-07-05 21:39:07 +00:00
uri: ssh://git@git.kun.is:56287/pim/static.git
2023-06-14 18:55:42 +00:00
branch: version
file: version
private_key: {{private_key}}
2023-06-14 19:44:56 +00:00
icon: numeric
2023-05-26 21:37:23 +00:00
notify-failed: &notify-failed
put: apprise-notification
params:
body: "Failed to deploy static website!"
2023-05-19 22:19:33 +00:00
jobs:
2023-05-26 09:01:33 +00:00
- name: build-static-website
2023-05-19 22:19:33 +00:00
plan:
- get: site-repo
trigger: true
- task: build-site
config:
platform: linux
image_resource:
type: registry-image
source:
2023-05-26 07:39:58 +00:00
repository: jekyll/builder
2023-05-19 22:19:33 +00:00
inputs:
- name: site-repo
outputs:
- name: site-html
params:
JEKYLL_ENV: production
run:
path: sh
args:
- -exc
- |
ls -lash
chown jekyll:jekyll site-html
cd site-repo/jekyll
bundle install
bundle exec jekyll build --disable-disk-cache --destination ../../site-html
2023-05-26 07:28:00 +00:00
on_failure:
<< : *notify-failed
2023-05-19 22:19:33 +00:00
- task: build-image
privileged: true
config:
platform: linux
image_resource:
type: registry-image
source:
repository: concourse/oci-build-task
inputs:
- name: site-repo
- name: site-html
outputs:
- name: image
params:
DOCKERFILE: site-repo/Dockerfile
2023-06-14 12:38:33 +00:00
LABELS_FILE: site-repo/labels
2023-05-19 22:19:33 +00:00
run:
path: sh
args:
- -exc
- |
build
ls image
2023-05-26 07:28:00 +00:00
on_failure:
<< : *notify-failed
2023-06-14 18:55:42 +00:00
- get: version
params:
2023-06-14 19:44:56 +00:00
bump: patch
2023-05-19 22:19:33 +00:00
- put: site-registry-image
params:
image: image/image.tar
2023-06-14 18:55:42 +00:00
additional_tags: version/version
2023-05-26 07:28:00 +00:00
on_failure:
<< : *notify-failed
2023-06-14 18:55:42 +00:00
- put: version
params:
file: version/version
2023-05-26 09:01:33 +00:00
- name: deploy-static-website
plan:
2023-06-14 19:44:56 +00:00
- get: version
2023-05-26 09:01:33 +00:00
trigger: true
2023-05-26 10:56:35 +00:00
passed: [build-static-website]
2023-05-26 09:01:33 +00:00
- get: site-repo
2023-06-14 19:44:56 +00:00
- get: site-registry-image
passed: [build-static-website]
2023-05-19 23:33:36 +00:00
- task: deploy-site
config:
platform: linux
image_resource:
type: registry-image
source:
repository: raesene/alpine-containertools
params:
DOCKER_HOST: ssh://root@maestro.dmz
inputs:
- name: site-repo
2023-05-26 09:01:33 +00:00
- name: site-registry-image
2023-06-14 19:44:56 +00:00
- name: version
2023-05-19 23:33:36 +00:00
run:
path: sh
args:
- -exc
- |
ls -lash
mkdir $HOME/.ssh
cp site-repo/ssh_config $HOME/.ssh/config
2023-05-19 23:33:36 +00:00
echo "((private_key))" > $HOME/.ssh/id_ed25519
chmod 600 $HOME/.ssh/id_ed25519
2023-06-14 19:44:56 +00:00
sed "s/TAG/$(cat version/version)/g" "site-repo/docker-stack.yml.template" > docker-stack.yml
cat docker-stack.yml
docker stack deploy --compose-file docker-stack.yml static
on_success:
2023-05-26 21:37:23 +00:00
put: apprise-notification
params:
2023-06-14 19:44:56 +00:00
title: "Static website deployed!"
body: "New version: $(cat version/version)"
2023-05-26 21:37:23 +00:00
no_get: true
2023-05-26 07:28:00 +00:00
on_failure:
<< : *notify-failed