drone-ci: Use guix-builder images instead of legacy guix image
This commit is contained in:
parent
9adc412a3c
commit
1e5ea8e220
217
.drone.yml
217
.drone.yml
|
@ -1,116 +1,133 @@
|
|||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: validate
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
pull: if-not-exists
|
||||
image: docker.nexus.home.rekahsoft.ca/guix:latest
|
||||
commands:
|
||||
- guix time-machine -C channels.scm -- build -f guix.scm
|
||||
|
||||
- name: promote-staging
|
||||
pull: if-not-exists
|
||||
image: docker.nexus.home.rekahsoft.ca/drone/cli:1.4-alpine
|
||||
commands:
|
||||
- export DRONE_SERVER="${DRONE_SYSTEM_PROTO}://${DRONE_SYSTEM_HOST}"
|
||||
- export DRONE_TOKEN
|
||||
- DRONE_PROMOTED_PIPELINE_ID=$(drone build promote --format '{{ .Number }}' "$DRONE_REPO" "$DRONE_BUILD_NUMBER" "staging")
|
||||
- "while status=\"$(drone build info --format '{{ .Status }}' $DRONE_REPO $DRONE_PROMOTED_PIPELINE_ID)\"; do\ncase \"$status\" in\n pending|running)\n sleep 30s\n ;;\n success)\n break\n ;;\n failure|error|killed)\n echo \"Promoted job with id $DRONE_PROMOTED_PIPELINE_ID failed with status '$status'.\"\n exit 1\n ;;\n *)\n echo \"Unknown pipeline status '$status'.\"\n exit 1\nesac\ndone"
|
||||
environment:
|
||||
DRONE_TOKEN:
|
||||
from_secret: drone_token
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
|
||||
- name: promote-production
|
||||
pull: if-not-exists
|
||||
image: docker.nexus.home.rekahsoft.ca/drone/cli:1.4-alpine
|
||||
commands:
|
||||
- export DRONE_SERVER="${DRONE_SYSTEM_PROTO}://${DRONE_SYSTEM_HOST}"
|
||||
- export DRONE_TOKEN
|
||||
- DRONE_PROMOTED_PIPELINE_ID=$(drone build promote --format '{{ .Number }}' "$DRONE_REPO" "$DRONE_BUILD_NUMBER" "production")
|
||||
- "while status=\"$(drone build info --format '{{ .Status }}' $DRONE_REPO $DRONE_PROMOTED_PIPELINE_ID)\"; do\ncase \"$status\" in\n pending|running)\n sleep 30s\n ;;\n success)\n break\n ;;\n failure|error|killed)\n echo \"Promoted job with id $DRONE_PROMOTED_PIPELINE_ID failed with status '$status'.\"\n exit 1\n ;;\n *)\n echo \"Unknown pipeline status '$status'.\"\n exit 1\nesac\ndone"
|
||||
environment:
|
||||
DRONE_TOKEN:
|
||||
from_secret: drone_token
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
|
||||
node:
|
||||
guix: on
|
||||
|
||||
guix: "on"
|
||||
steps:
|
||||
- commands:
|
||||
- guix time-machine -C channels.scm -- build -f guix.scm
|
||||
image: docker.nexus.home.rekahsoft.ca/guix-builder:latest
|
||||
name: build
|
||||
pull: if-not-exists
|
||||
- commands:
|
||||
- export DRONE_SERVER="${DRONE_SYSTEM_PROTO}://${DRONE_SYSTEM_HOST}"
|
||||
- export DRONE_TOKEN
|
||||
- DRONE_PROMOTED_PIPELINE_ID=$(drone build promote --format '{{ .Number }}' "$DRONE_REPO"
|
||||
"$DRONE_BUILD_NUMBER" "staging")
|
||||
- |-
|
||||
while status="$(drone build info --format '{{ .Status }}' $DRONE_REPO $DRONE_PROMOTED_PIPELINE_ID)"; do
|
||||
case "$status" in
|
||||
pending|running)
|
||||
sleep 30s
|
||||
;;
|
||||
success)
|
||||
break
|
||||
;;
|
||||
failure|error|killed)
|
||||
echo "Promoted job with id $DRONE_PROMOTED_PIPELINE_ID failed with status '$status'."
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "Unknown pipeline status '$status'."
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
environment:
|
||||
DRONE_TOKEN:
|
||||
from_secret: drone_token
|
||||
image: docker.nexus.home.rekahsoft.ca/drone/cli:1.4-alpine
|
||||
name: promote-staging
|
||||
pull: if-not-exists
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
- commands:
|
||||
- export DRONE_SERVER="${DRONE_SYSTEM_PROTO}://${DRONE_SYSTEM_HOST}"
|
||||
- export DRONE_TOKEN
|
||||
- DRONE_PROMOTED_PIPELINE_ID=$(drone build promote --format '{{ .Number }}' "$DRONE_REPO"
|
||||
"$DRONE_BUILD_NUMBER" "production")
|
||||
- |-
|
||||
while status="$(drone build info --format '{{ .Status }}' $DRONE_REPO $DRONE_PROMOTED_PIPELINE_ID)"; do
|
||||
case "$status" in
|
||||
pending|running)
|
||||
sleep 30s
|
||||
;;
|
||||
success)
|
||||
break
|
||||
;;
|
||||
failure|error|killed)
|
||||
echo "Promoted job with id $DRONE_PROMOTED_PIPELINE_ID failed with status '$status'."
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "Unknown pipeline status '$status'."
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
environment:
|
||||
DRONE_TOKEN:
|
||||
from_secret: drone_token
|
||||
image: docker.nexus.home.rekahsoft.ca/drone/cli:1.4-alpine
|
||||
name: promote-production
|
||||
pull: if-not-exists
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
- tag
|
||||
|
||||
type: docker
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: deploy
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: init
|
||||
pull: if-not-exists
|
||||
image: docker.nexus.home.rekahsoft.ca/guix:latest
|
||||
commands:
|
||||
- cd infra
|
||||
- "guix time-machine -C ../channels.scm -- shell -m manifest.scm -- make setup ENV=\"${DRONE_DEPLOY_TO}\" "
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: aws_access_key_id
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: aws_secret_access_key
|
||||
|
||||
- name: plan
|
||||
pull: if-not-exists
|
||||
image: docker.nexus.home.rekahsoft.ca/guix:latest
|
||||
commands:
|
||||
- export TF_VAR_site_static_files_dir="$(guix time-machine -C channels.scm -- build -f guix.scm | grep -e '^.*-site$')"
|
||||
- cd infra
|
||||
- "guix time-machine -C ../channels.scm -- shell -m manifest.scm -- make plan ENV=\"${DRONE_DEPLOY_TO}\" "
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: aws_access_key_id
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: aws_secret_access_key
|
||||
PLAN: out.plan
|
||||
|
||||
- name: deploy
|
||||
pull: if-not-exists
|
||||
image: docker.nexus.home.rekahsoft.ca/guix:latest
|
||||
commands:
|
||||
- cd infra
|
||||
- "guix time-machine -C ../channels.scm -- shell -m manifest.scm -- make deploy ENV=\"${DRONE_DEPLOY_TO}\" "
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: aws_access_key_id
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: aws_secret_access_key
|
||||
PLAN: out.plan
|
||||
|
||||
node:
|
||||
guix: on
|
||||
|
||||
guix: "on"
|
||||
steps:
|
||||
- commands:
|
||||
- cd infra
|
||||
- 'guix time-machine -C ../channels.scm -- shell -m manifest.scm -- make setup ENV="${DRONE_DEPLOY_TO}" '
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: aws_access_key_id
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: aws_secret_access_key
|
||||
image: docker.nexus.home.rekahsoft.ca/guix-builder:latest
|
||||
name: init
|
||||
pull: if-not-exists
|
||||
- commands:
|
||||
- export TF_VAR_site_static_files_dir="$(guix time-machine -C channels.scm -- build
|
||||
-f guix.scm | grep -e '^.*-site$')"
|
||||
- cd infra
|
||||
- 'guix time-machine -C ../channels.scm -- shell -m manifest.scm -- make plan ENV="${DRONE_DEPLOY_TO}" '
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: aws_access_key_id
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: aws_secret_access_key
|
||||
PLAN: out.plan
|
||||
image: docker.nexus.home.rekahsoft.ca/guix-builder:latest
|
||||
name: plan
|
||||
pull: if-not-exists
|
||||
- commands:
|
||||
- cd infra
|
||||
- 'guix time-machine -C ../channels.scm -- shell -m manifest.scm -- make deploy
|
||||
ENV="${DRONE_DEPLOY_TO}" '
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: aws_access_key_id
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: aws_secret_access_key
|
||||
PLAN: out.plan
|
||||
image: docker.nexus.home.rekahsoft.ca/guix-builder:latest
|
||||
name: deploy
|
||||
pull: if-not-exists
|
||||
trigger:
|
||||
event:
|
||||
- promote
|
||||
|
||||
...
|
||||
type: docker
|
||||
|
|
|
@ -134,10 +134,10 @@
|
|||
.withType("docker")
|
||||
.withNode({ "guix": "on"}),
|
||||
|
||||
step(name, commands, image="docker.nexus.home.rekahsoft.ca/guix:latest")::
|
||||
step(name, commands, image="docker.nexus.home.rekahsoft.ca/guix-builder:latest")::
|
||||
ci.pipeline.step.new(name, image).withPullIfNotExists().withCommands(commands),
|
||||
|
||||
stepTimeMachine(name, commands, cwd=".", channels="channels.scm", image="docker.nexus.home.rekahsoft.ca/guix:latest")::
|
||||
stepTimeMachine(name, commands, cwd=".", channels="channels.scm", image="docker.nexus.home.rekahsoft.ca/guix-builder:latest")::
|
||||
ci.pipeline.step.new(name, image).withPullIfNotExists().withCommands(
|
||||
// Conditionally change directory
|
||||
(if cwd == "."
|
||||
|
|
Loading…
Reference in New Issue