commit 849799d5606418d9679a2e576bb17e51f12d2d8e Author: Philipp Dieter Date: Mon Apr 10 17:52:19 2023 +0200 [TASK] Init diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b104217 --- /dev/null +++ b/Makefile @@ -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 diff --git a/pipeline.yml b/pipeline.yml new file mode 100644 index 0000000..9845a3b --- /dev/null +++ b/pipeline.yml @@ -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