Skip to content

Commit

Permalink
ci: add Concourse pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
KoltesDigital committed Oct 4, 2024
1 parent d456800 commit da4fdf7
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/concourse.jsonnet eol=lf

# https://gitattributes.io/api/web

# Content
Expand Down Expand Up @@ -73,4 +75,4 @@
*.eot binary
*.otf binary
*.woff binary
*.woff2 binary
*.woff2 binary
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ public
.log

# macOS related files
.DS_Store
.DS_Store

# CICD
/.concourse
133 changes: 133 additions & 0 deletions concourse.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
local GITEA_CREDENTIALS = {
password: '((gitea-access-token))',
username: 'concourse',
};
local GITEA_HOST = 'gitea.cookie.paris';

local DOCKER_IMAGE_RESOURCE = {
name: 'docker-image',
source: GITEA_CREDENTIALS {
repository: GITEA_HOST + '/collective/ccc-website',
tag: 'latest',
},
type: 'registry-image',
};

local GIT_REPOSITORY_RESOURCE = {
name: 'git-repository',
source: {
uri: 'https://github.com/CookieCollective/ccc-website.git',
},
type: 'git',
};

local BUILD_DOCKER_IMAGE_TASK = {
caches: [
{
path: 'cache',
},
],
image_resource: {
source: {
repository: 'concourse/oci-build-task',
},
type: 'registry-image',
},
inputs: [
{
name: GIT_REPOSITORY_RESOURCE.name,
path: '.',
},
],
outputs: [
{
name: 'image',
},
],
platform: 'linux',
run: {
path: 'build',
},
};

{
'pipelines-main.json': {
jobs: [
{
local JSONNET_OUTPUT = '.concourse',
name: 'update-pipelines',
plan: [
{
get: GIT_REPOSITORY_RESOURCE.name,
trigger: true,
},
{
task: 'generate-concourse-files',
config: {
image_resource: {
source: {
repository: 'bitnami/jsonnet',
},
type: 'registry-image',
},
inputs: [
{
name: GIT_REPOSITORY_RESOURCE.name,
},
],
outputs: [
{
name: 'concourse',
},
],
platform: 'linux',
run: {
args: [
'-m',
JSONNET_OUTPUT,
GIT_REPOSITORY_RESOURCE.name + '/concourse.jsonnet',
],
path: 'jsonnet',
user: 'root',
},
},
},
{
file: JSONNET_OUTPUT + '/pipelines-main.json',
set_pipeline: 'ccc-website',
},
],
public: true,
},
{
name: 'build',
plan: [
{
get: GIT_REPOSITORY_RESOURCE.name,
passed: [
'update-pipelines',
],
trigger: true,
},
{
config: BUILD_DOCKER_IMAGE_TASK,
privileged: true,
task: 'build-docker-image',
},
{
put: DOCKER_IMAGE_RESOURCE.name,
params: {
image: 'image/image.tar',
},
},
],
public: true,
},
],
resources: [
DOCKER_IMAGE_RESOURCE,
GIT_REPOSITORY_RESOURCE,
],
},
'tasks-build-docker-image.json': BUILD_DOCKER_IMAGE_TASK,
}

0 comments on commit da4fdf7

Please sign in to comment.