[TASK] Init

This commit is contained in:
Philipp Dieter 2023-04-10 17:52:19 +02:00
commit 849799d560
2 changed files with 110 additions and 0 deletions

5
Makefile Normal file
View File

@ -0,0 +1,5 @@
set_pipeline:
fly -t datentonne sp -p sshpiper -c pipeline.yml
trigger_job:
fly -t datentonne tj -j sshpiper/build -w

105
pipeline.yml Normal file
View File

@ -0,0 +1,105 @@
---
resource_types:
- name: aptly-resource
type: docker-image
source:
repository: docker.datentonne.net/concourse/aptly-resource
tag: latest
resources:
- name: sshpiper
type: github-release
source:
owner: tg123
repository: sshpiper
access_token: ((github.access_token))
- name: sshpiper-deb
type: aptly-resource
source:
api_uri: https://apt-api.datentonne.net/
repo_uri: https://apt.datentonne.net/
repo: datentonne
distribution: debian
component: main
architecture: amd64
package: sshpiper
username: ((aptly.username))
password: ((aptly.password))
timeout: 1801
jobs:
- name: build
plan:
- get: sshpiper
trigger: true
params:
#include_source_tarball: true
#include_source_zip: true
# globs:
# - v*.tar.gz
- task: build
config:
platform: linux
image_resource:
type: registry-image
source:
repository: docker.datentonne.net/go/go-docker
tag: latest
inputs:
- name: sshpiper
outputs:
- name: deb
caches:
- path: go-build
caches:
- path: go-mod
run:
path: /bin/sh
args:
- -c
- |
export VERSION="$(cat sshpiper/version)"
export VERSION_OUT="$(cat sshpiper/version)-$(date +%s)"
export GOCACHE="$(pwd)/go-build"
export GOMODCACHE="$(pwd)/go-mod"
mkdir sshpiper/source
git clone https://github.com/tg123/sshpiper sshpiper/source
cd sshpiper/source
git submodule update --init --recursive
mkdir -p out/usr/bin
mkdir -p out/etc
mkdir -p out/var/lib/sshpiper
cat <<- EOF > sshpiper.service
[Unit]
Description=SSHPiper Daemon
Requires=network.target
After=network.target
[Service]
ExecStart=/usr/local/bin/sshpiperd daemon
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=sshpiperd
User=root
Group=root
[Install]
WantedBy=multi-user.target
EOF
go build -v -x -tags full -o out/usr/bin ./...
fpm \
--verbose \
-f \
-n sshpiper \
-s dir \
-t deb \
-v $VERSION_OUT \
--deb-systemd sshpiper.service \
--deb-systemd-restart-after-upgrade \
out/=/
dpkg --contents sshpiper_${VERSION_OUT}_amd64.deb
cd ../..
mv -v sshpiper/source/sshpiper_${VERSION_OUT}_amd64.deb deb/
echo "deb/sshpiper_${VERSION_OUT}_amd64.deb" > deb/filename
- put: sshpiper-deb
params:
archive_file: deb/filename
gpg_passphrase_file: /etc/hosts