.gitlab-ci.yml 1.41 KiB
stages:
- build
- upload
- test
compile:
stage: build
image: golang:alpine
script:
- source ./env
- go build -tags "$TAGS" -ldflags "$LDFLAGS" ./cmd/hepto.go
artifacts:
paths:
- hepto
expire_in: 1 week
variables:
GOPATH: $CI_PROJECT_DIR/.go
before_script:
- apk add --no-cache git gcc g++ libseccomp-dev libseccomp-static
- git fetch --tags
- mkdir -p .go
cache:
paths:
- .go/pkg/mod/
.before_script_template: &ansible-job
image: docker.tedomum.net/acides/ansible-ci:main
before_script:
- apk --no-cache add openssh-client
- echo "$VAULT_PASSWORD" > /tmp/vault
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_KEY"|base64 -d)
- pip install ansible boto3 netaddr
variables:
ANSIBLE_ARGS: -i .ansible-ci.yaml --vault-password-file /tmp/vault -e node_prefix=ci-$CI_JOB_ID
upload:
stage: upload
<<: *ansible-job
script:
- ansible $ANSIBLE_ARGS -m include_tasks -a file=ansible/ciupload.yaml localhost
test:
stage: test
<<: *ansible-job
parallel:
matrix:
- PROVIDER: scaleway
IMAGE:
- debian12
- PROVIDER: hetzner
IMAGE:
- debian12
script:
- ansible-playbook $ANSIBLE_ARGS ansible/cloud.yaml -e cloud_provider=$PROVIDER -e image=$IMAGE
- ansible-playbook $ANSIBLE_ARGS ansible/test_podinfo.yaml
after_script:
- ansible-playbook $ANSIBLE_ARGS ansible/cleanup.yaml