Files
singh3/ci/pipeline.yml
2022-02-20 21:02:55 +05:30

136 lines
2.8 KiB
YAML

resource_types:
- name: nomad
type: registry-image
source:
repository: natto17/concourse-nomad-resource
tag: latest
resources:
- name: image
type: registry-image
icon: docker
source:
repository: ((docker.user))/singh3
tag: latest
username: ((docker.user))
password: ((docker.pass))
- name: nomad-job
type: nomad
source:
url: https://nomad.weirdnatto.in
name: singh3
token: ((nomad.token))
consul_token: ((nomad.consul))
vault_token: ((nomad.vault))
templating: false
restart: true
- name: release
type: gitea-release-resource
source:
repository: natto1784/singh3
access_token: ((gitea.token))
gitea_api_url: ((gitea.url))
- name: repo
type: git
icon: discord
source:
uri: https://git.weirdnatto.in/natto1784/singh3.git
branch: master
- name: rust-latest-image
type: registry-image
icon: docker
source:
repository: arm64v8/rust
tag: latest
jobs:
- name: configure-self
public: true
plan:
- get: repo
trigger: true
- set_pipeline: self
file: repo/ci/pipeline.yml
- name: singh3
plan:
- get: repo
trigger: true
passed: [configure-self]
- get: rust-latest-image
trigger: false
- task: format
image: rust-latest-image
config:
inputs:
- name: repo
platform: linux
run:
path: sh
args:
- -c
- |
rustup component add rustfmt
cargo fmt
dir: repo
- task: build
image: rust-latest-image
config:
params:
CARGO_HOME: cargo-home
CARGO_TARGET_DIR: builddir
inputs:
- name: repo
caches:
- path: builddir
- path: cargo-home
platform: linux
run:
path: sh
args:
- -c
- |
cargo build --release --manifest-path repo/Cargo.toml
mkdir release
mv $CARGO_TARGET_DIR/release/singh3 release/aarch64-bin
awk '/^version = /{gsub(/^"|"$/,"", $3); print $3; exit}' \
repo/Cargo.toml > release/tag
awk '/^name = /{gsub(/^"|"$/,"", $3); print $3; exit}' \
repo/Cargo.toml > release/title
outputs:
- name: release
- task: push-image
privileged: true
config:
platform: linux
image_resource:
type: registry-image
source:
repository: rdclda/concourse-oci-build-task
caches:
- path: cache
inputs:
- name: release
outputs:
- name: image
run:
path: sh
args:
- -c
- |
cat <<EOF > Dockerfile
FROM arm64v8/ubuntu
COPY release/aarch64-bin /usr/bin/singh3
CMD ["singh3"]
EOF
build
- put: image
params:
image: image/image.tar
- put: nomad-job
params:
job_path: repo/singh3.nomad