Skip to content

feat: add docket export command #175

feat: add docket export command

feat: add docket export command #175

Workflow file for this run

---
name: test
# yamllint disable-line rule:truthy
on:
pull_request:
branches:
- '*'
push:
branches:
- 'master'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-test:
name: unit-test
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: run unit tests
run: go test -v -count=1 . ./commands/ ./tasks/ ./subprocess/
integration-test:
name: integration-test
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: enable docker legacy link support
run: |
sudo mkdir -p /etc/systemd/system/docker.service.d
printf '[Service]\nEnvironment="DOCKER_KEEP_DEPRECATED_LEGACY_LINKS_ENV_VARS=1"\n' | sudo tee /etc/systemd/system/docker.service.d/legacy-links.conf
sudo systemctl daemon-reload
sudo systemctl restart docker
- name: install dokku
run: |
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://packagecloud.io/dokku/dokku/gpgkey | sudo gpg --dearmor -o /etc/apt/keyrings/dokku-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/dokku-archive-keyring.gpg] https://packagecloud.io/dokku/dokku/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/dokku.list
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qq -y dokku=0.38.15
sudo dokku plugin:install-dependencies --core
- name: install dokku redis plugin
run: sudo dokku plugin:install https://github.com/dokku/dokku-redis.git redis
- name: install dokku http-auth plugin
run: sudo dokku plugin:install https://github.com/dokku/dokku-http-auth.git http-auth
- name: install dokku global-cert plugin
run: sudo dokku plugin:install https://github.com/dokku-community/dokku-global-cert.git global-cert
- name: install dokku letsencrypt plugin
run: sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git --committish 0.25.0 letsencrypt
- name: install dokku acl plugin
run: sudo dokku plugin:install https://github.com/dokku-community/dokku-acl.git acl
- name: install dokku maintenance plugin
run: sudo dokku plugin:install https://github.com/dokku/dokku-maintenance.git maintenance
- name: run integration tests (shard ${{ matrix.shard }} of 4)
run: sudo DOKKU_TEST_SHARD=${{ matrix.shard }} DOKKU_TEST_SHARDS=4 go test -v -count=1 -timeout 20m -run TestIntegration ./tasks/
scheduler-k3s-test:
name: scheduler-k3s-test
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: enable docker legacy link support
run: |
sudo mkdir -p /etc/systemd/system/docker.service.d
printf '[Service]\nEnvironment="DOCKER_KEEP_DEPRECATED_LEGACY_LINKS_ENV_VARS=1"\n' | sudo tee /etc/systemd/system/docker.service.d/legacy-links.conf
sudo systemctl daemon-reload
sudo systemctl restart docker
- name: install dokku
run: |
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://packagecloud.io/dokku/dokku/gpgkey | sudo gpg --dearmor -o /etc/apt/keyrings/dokku-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/dokku-archive-keyring.gpg] https://packagecloud.io/dokku/dokku/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/dokku.list
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qq -y dokku=0.38.15
sudo dokku plugin:install-dependencies --core
- name: initialize k3s cluster
run: sudo dokku scheduler-k3s:initialize --server-ip 127.0.0.1
- name: run scheduler-k3s integration tests
run: sudo DOKKU_TEST_SCHEDULER_K3S=1 go test -v -count=1 -timeout 30m -run '^TestIntegrationSchedulerK3s' ./tasks/
bats-test:
name: bats-test
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: enable docker legacy link support
run: |
sudo mkdir -p /etc/systemd/system/docker.service.d
printf '[Service]\nEnvironment="DOCKER_KEEP_DEPRECATED_LEGACY_LINKS_ENV_VARS=1"\n' | sudo tee /etc/systemd/system/docker.service.d/legacy-links.conf
sudo systemctl daemon-reload
sudo systemctl restart docker
- name: install dokku
run: |
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://packagecloud.io/dokku/dokku/gpgkey | sudo gpg --dearmor -o /etc/apt/keyrings/dokku-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/dokku-archive-keyring.gpg] https://packagecloud.io/dokku/dokku/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/dokku.list
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qq -y dokku=0.38.15
sudo dokku plugin:install-dependencies --core
- name: install bats
run: sudo apt-get install -qq -y bats bats-support bats-assert
- name: build docket
run: go build -o docket .
- name: setup ssh to localhost for ssh transport tests
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t ed25519 -N '' -f ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
ssh-keyscan -H localhost >> ~/.ssh/known_hosts
ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts
ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new "$USER@localhost" 'echo ssh-ok'
# Mirror the developer's SSH setup into the root user that bats
# runs as via sudo, so DOKKU_HOST=$USER@localhost works under
# `sudo --preserve-env=PATH`.
sudo mkdir -p /root/.ssh
sudo chmod 700 /root/.ssh
sudo cp ~/.ssh/id_ed25519 /root/.ssh/id_ed25519
sudo cp ~/.ssh/id_ed25519.pub /root/.ssh/id_ed25519.pub
sudo cp ~/.ssh/known_hosts /root/.ssh/known_hosts
sudo chmod 600 /root/.ssh/id_ed25519
- name: export remote host fixture
run: echo "DOCKET_TEST_REMOTE_HOST=$USER@localhost" >> $GITHUB_ENV
- name: run bats tests
run: sudo --preserve-env=PATH,DOCKET_TEST_REMOTE_HOST bats tests/bats/