From fde22837353ea413ce0007f3e014760e9b99bf9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 20 Feb 2021 00:12:50 +0100 Subject: [PATCH 01/14] Adds github action to build on debian10 runner. Adds build of deb package. Adds publishing of package to nexus Renamed workflow Enabled manually triggering nightly job First try of building rpm Removed running tests for now Fixed path to rpm Spec Added pwd to prefix topdir with buildtarget directory Path stuff More path stuff Hopefully fixed some stuff.. Forgot to check in half the files.. Hard coded service name Steal password.. Steal password.. Added Centos7 build job First try of adding deb package information Added assets Added apt build Removed copy&paste error Changed agent config directories and added postinst script to create empty dirs. Added DEBHELPER marker to postinst Added config options to place certificate and key file under the agent data directory by default. Refactored to include only deb changes. --- .github/workflows/nightly.yml | 23 +++++++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 10 +++++++++- packaging/config/agent.conf | 5 +++++ packaging/debian/postinst | 7 +++++++ packaging/debian/service | 14 ++++++++++++++ 6 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/nightly.yml create mode 100644 packaging/config/agent.conf create mode 100644 packaging/debian/postinst create mode 100644 packaging/debian/service diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..b2de926 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,23 @@ +name: Centos8-Nightly + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +jobs: + debian10: + runs-on: debian10 + steps: + - uses: actions/checkout@v2 + - name: Build + run: ~/.cargo/bin/cargo +nightly build --verbose --release + - name: Build apt package + run: ~/.cargo/bin/cargo deb + - name: Publish apt package + run: /usr/bin/curl -u 'github:${{ secrets.NEXUS_PASSWORD }}' -H "Content-Type: multipart/form-data" --data-binary "@./target/debian/stackable-agent_0.1.0-nightly_amd64.deb" "https://repo.stackable.tech/repository/deb-nightly/" \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index aebec32..32d23f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2700,7 +2700,7 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "stackable-agent" -version = "0.1.0" +version = "0.1.0-nightly" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 62b1bc0..4f45ad1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stackable-agent" -version = "0.1.0" +version = "0.1.0-nightly" authors = ["Sönke Liebau "] edition = "2018" @@ -46,3 +46,11 @@ serde_yaml = "0.8" opt-level = "s" lto = true codegen-units = 1 + +[package.metadata.deb] +maintainer-scripts = "packaging/debian/" +systemd-units = { enable = false } +assets = [ + ["rpm/SOURCES/stackable-agent-0.1.0/etc/stackable-agent/agent.conf", "etc/stackable-agent/", "644"], + ["target/release/agent", "opt/stackable-agent/stackable-agent", "755"], +] \ No newline at end of file diff --git a/packaging/config/agent.conf b/packaging/config/agent.conf new file mode 100644 index 0000000..508bf3a --- /dev/null +++ b/packaging/config/agent.conf @@ -0,0 +1,5 @@ +--package-directory=/var/lib/stackable/packages +--config-directory=/var/lib/stackable/config +--data-directory=/var/lib/stackable/agentdata +--server-key-file=/var/lib/stackable/agentdata/config/agent.key +--server-cert-file=/var/lib/stackable/agentdata/config/agent.crt \ No newline at end of file diff --git a/packaging/debian/postinst b/packaging/debian/postinst new file mode 100644 index 0000000..5b21838 --- /dev/null +++ b/packaging/debian/postinst @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +mkdir -p /var/lib/stackable/packages +mkdir -p /var/lib/stackable/config +mkdir -p /var/lib/stackable/agentdata/config + +#DEBHELPER# \ No newline at end of file diff --git a/packaging/debian/service b/packaging/debian/service new file mode 100644 index 0000000..9c4e0c9 --- /dev/null +++ b/packaging/debian/service @@ -0,0 +1,14 @@ +[Unit] +Description=Stackable Agent +Before= +After=network.target +[Service] +User=root +ExecStart=/opt/stackable-agent/stackable-agent +Restart=on-abort +StandardOutput=journal +StandardError=journal +Environment="CONFIG_FILE=/etc/stackable-agent/agent.conf" +Environment="RUST_LOG=info,stackable_agent::provider::states=debug,stackable_agent::agentconfig=trace" +[Install] +WantedBy=multi-user.target From c4568429bde637e09a7340d2bfaef2e7e068be27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 27 Feb 2021 13:30:51 +0100 Subject: [PATCH 02/14] Yaml shit --- .github/workflows/nightly.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b2de926..3efa6a8 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -20,4 +20,9 @@ jobs: - name: Build apt package run: ~/.cargo/bin/cargo deb - name: Publish apt package - run: /usr/bin/curl -u 'github:${{ secrets.NEXUS_PASSWORD }}' -H "Content-Type: multipart/form-data" --data-binary "@./target/debian/stackable-agent_0.1.0-nightly_amd64.deb" "https://repo.stackable.tech/repository/deb-nightly/" \ No newline at end of file + run: >- + /usr/bin/curl + -u 'github:${{ secrets.NEXUS_PASSWORD }}' + -H 'Content-Type: multipart/form-data' + --data-binary '@./target/debian/stackable-agent_0.1.0-nightly_amd64.deb' + 'https://repo.stackable.tech/repository/deb-nightly/' \ No newline at end of file From 8803203c06d94f617e0a470dab1730ac61f53984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 27 Feb 2021 13:32:58 +0100 Subject: [PATCH 03/14] More Yaml shit --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 3efa6a8..9bb37a7 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -20,7 +20,7 @@ jobs: - name: Build apt package run: ~/.cargo/bin/cargo deb - name: Publish apt package - run: >- + run: | /usr/bin/curl -u 'github:${{ secrets.NEXUS_PASSWORD }}' -H 'Content-Type: multipart/form-data' From 905df33c1d98905534f4ce35d969f2746805422d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 27 Feb 2021 13:34:27 +0100 Subject: [PATCH 04/14] Still more Yaml shit --- .github/workflows/nightly.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 9bb37a7..ebbc336 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -20,9 +20,4 @@ jobs: - name: Build apt package run: ~/.cargo/bin/cargo deb - name: Publish apt package - run: | - /usr/bin/curl - -u 'github:${{ secrets.NEXUS_PASSWORD }}' - -H 'Content-Type: multipart/form-data' - --data-binary '@./target/debian/stackable-agent_0.1.0-nightly_amd64.deb' - 'https://repo.stackable.tech/repository/deb-nightly/' \ No newline at end of file + run: /usr/bin/curl -u 'github:${{ secrets.NEXUS_PASSWORD }}' --data-binary '@./target/debian/stackable-agent_0.1.0-nightly_amd64.deb' 'https://repo.stackable.tech/repository/deb-nightly/' \ No newline at end of file From 9502fd3a80930f8646f084942fa3e1415b286a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 27 Feb 2021 13:53:29 +0100 Subject: [PATCH 05/14] Fixed asset path and next try to get yaml working --- .github/workflows/nightly.yml | 9 +++++++-- Cargo.toml | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ebbc336..902105a 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -18,6 +18,11 @@ jobs: - name: Build run: ~/.cargo/bin/cargo +nightly build --verbose --release - name: Build apt package - run: ~/.cargo/bin/cargo deb + run: ~/.cargo/bin/cargo deb --no-build - name: Publish apt package - run: /usr/bin/curl -u 'github:${{ secrets.NEXUS_PASSWORD }}' --data-binary '@./target/debian/stackable-agent_0.1.0-nightly_amd64.deb' 'https://repo.stackable.tech/repository/deb-nightly/' \ No newline at end of file + run: > + /usr/bin/curl + -u 'github:${{ secrets.NEXUS_PASSWORD }}' + -H "Content-Type: multipart/form-data" + --data-binary "@./target/debian/stackable-agent_0.1.0-nightly_amd64.deb" + "https://repo.stackable.tech/repository/deb-nightly/" \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 4f45ad1..c8dc9a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,6 +51,6 @@ codegen-units = 1 maintainer-scripts = "packaging/debian/" systemd-units = { enable = false } assets = [ - ["rpm/SOURCES/stackable-agent-0.1.0/etc/stackable-agent/agent.conf", "etc/stackable-agent/", "644"], + ["packaging/config/agent.conf", "etc/stackable-agent/", "644"], ["target/release/agent", "opt/stackable-agent/stackable-agent", "755"], ] \ No newline at end of file From cf88354fa782a934a1e8376472293e82423cad64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 27 Feb 2021 14:02:19 +0100 Subject: [PATCH 06/14] Added verbose flag to curl --- .github/workflows/nightly.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 902105a..34d33b6 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -22,6 +22,7 @@ jobs: - name: Publish apt package run: > /usr/bin/curl + -vvvv -u 'github:${{ secrets.NEXUS_PASSWORD }}' -H "Content-Type: multipart/form-data" --data-binary "@./target/debian/stackable-agent_0.1.0-nightly_amd64.deb" From 2e3b7e47ab0ae4213d2727eda3347fd3963094a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 27 Feb 2021 14:12:07 +0100 Subject: [PATCH 07/14] Change action to run at midnight or on manual trigger. --- .github/workflows/nightly.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 34d33b6..b9e98dc 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,10 +1,8 @@ -name: Centos8-Nightly +name: Publish-Nightly-Packages on: - push: - branches: - - main - pull_request: + schedule: + - cron: '0 0 * * *' workflow_dispatch: env: From e610cbdb4b1bbf627bc59dbbcdae34c0798b0aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 27 Feb 2021 14:19:27 +0100 Subject: [PATCH 08/14] Changed upload action to look for deb files instead of taking a hardcoded version. --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b9e98dc..c0098a2 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -23,5 +23,5 @@ jobs: -vvvv -u 'github:${{ secrets.NEXUS_PASSWORD }}' -H "Content-Type: multipart/form-data" - --data-binary "@./target/debian/stackable-agent_0.1.0-nightly_amd64.deb" + --data-binary "$(find target/debian/ -name *.deb)" "https://repo.stackable.tech/repository/deb-nightly/" \ No newline at end of file From 0c1e691afddee4d837e1707720c14fd1f7409918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 27 Feb 2021 20:07:53 +0100 Subject: [PATCH 09/14] Added --fail to curl call and re-enabled workflow to run on pr for testing purposes. --- .github/workflows/nightly.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c0098a2..b03cdd0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,6 +1,10 @@ name: Publish-Nightly-Packages on: + push: + branches: + - main + pull_request: schedule: - cron: '0 0 * * *' workflow_dispatch: @@ -21,6 +25,7 @@ jobs: run: > /usr/bin/curl -vvvv + --fail -u 'github:${{ secrets.NEXUS_PASSWORD }}' -H "Content-Type: multipart/form-data" --data-binary "$(find target/debian/ -name *.deb)" From 5f79a562ef18e8248f2d5c9dbe9dc97a5eb36d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 27 Feb 2021 20:16:28 +0100 Subject: [PATCH 10/14] Added description to see if this triggers the wf to run. --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index c8dc9a2..de3fb6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "stackable-agent" +description = "Tha component of the Stackable Platform that manages installation of services on the workers" version = "0.1.0-nightly" authors = ["Sönke Liebau "] edition = "2018" From c43da843cbf9156ab65a33353e71d5be7e738ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 27 Feb 2021 20:31:17 +0100 Subject: [PATCH 11/14] Next try to get the workflow to run.. --- .github/workflows/nightly.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b03cdd0..e41588f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -5,9 +5,6 @@ on: branches: - main pull_request: - schedule: - - cron: '0 0 * * *' - workflow_dispatch: env: CARGO_TERM_COLOR: always From 167915cd659efbd3ed673b54a2f46268a9fae7e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sat, 27 Feb 2021 20:33:33 +0100 Subject: [PATCH 12/14] Aaand another try to get the workflow to run.. --- .github/workflows/nightly.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e41588f..d47c7b9 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -4,7 +4,11 @@ on: push: branches: - main + - deb pull_request: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: env: CARGO_TERM_COLOR: always From 7b3f6b86762119c0ce30c4071d405afcf8d09ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Tue, 2 Mar 2021 10:29:25 +0100 Subject: [PATCH 13/14] Made nightly.yml match other repos. Added license to toml --- .github/workflows/nightly.yml | 11 +++-------- Cargo.toml | 1 + 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d47c7b9..8be7ae2 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -4,11 +4,6 @@ on: push: branches: - main - - deb - pull_request: - schedule: - - cron: '0 0 * * *' - workflow_dispatch: env: CARGO_TERM_COLOR: always @@ -21,13 +16,13 @@ jobs: - name: Build run: ~/.cargo/bin/cargo +nightly build --verbose --release - name: Build apt package - run: ~/.cargo/bin/cargo deb --no-build + run: ~/.cargo/bin/cargo deb --manifest-path server/Cargo.toml --no-build - name: Publish apt package - run: > + run: >- /usr/bin/curl -vvvv --fail -u 'github:${{ secrets.NEXUS_PASSWORD }}' -H "Content-Type: multipart/form-data" - --data-binary "$(find target/debian/ -name *.deb)" + --data-binary "@./$(find target/debian/ -name *.deb)" "https://repo.stackable.tech/repository/deb-nightly/" \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index de3fb6f..34bdbb2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ description = "Tha component of the Stackable Platform that manages installation version = "0.1.0-nightly" authors = ["Sönke Liebau "] edition = "2018" +license = "Apache-2.0" [dependencies] # We are currently referencing the Krustlet directly from a Stackable fork of the official repository. From eb6b81d15cdf855a7f6fa390ee6abe64d2279433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Tue, 2 Mar 2021 11:02:01 +0100 Subject: [PATCH 14/14] Addressed Lars' comments. --- packaging/config/agent.conf | 6 +++--- packaging/debian/postinst | 2 +- packaging/debian/service | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packaging/config/agent.conf b/packaging/config/agent.conf index 508bf3a..19ae909 100644 --- a/packaging/config/agent.conf +++ b/packaging/config/agent.conf @@ -1,5 +1,5 @@ --package-directory=/var/lib/stackable/packages --config-directory=/var/lib/stackable/config ---data-directory=/var/lib/stackable/agentdata ---server-key-file=/var/lib/stackable/agentdata/config/agent.key ---server-cert-file=/var/lib/stackable/agentdata/config/agent.crt \ No newline at end of file +--data-directory=/var/lib/stackable/agent +--server-key-file=/var/lib/stackable/agent/config/agent.key +--server-cert-file=/var/lib/stackable/agent/config/agent.crt \ No newline at end of file diff --git a/packaging/debian/postinst b/packaging/debian/postinst index 5b21838..320bab6 100644 --- a/packaging/debian/postinst +++ b/packaging/debian/postinst @@ -2,6 +2,6 @@ mkdir -p /var/lib/stackable/packages mkdir -p /var/lib/stackable/config -mkdir -p /var/lib/stackable/agentdata/config +mkdir -p /var/lib/stackable/agent/config #DEBHELPER# \ No newline at end of file diff --git a/packaging/debian/service b/packaging/debian/service index 9c4e0c9..1825efa 100644 --- a/packaging/debian/service +++ b/packaging/debian/service @@ -9,6 +9,6 @@ Restart=on-abort StandardOutput=journal StandardError=journal Environment="CONFIG_FILE=/etc/stackable-agent/agent.conf" -Environment="RUST_LOG=info,stackable_agent::provider::states=debug,stackable_agent::agentconfig=trace" +Environment="RUST_LOG=info" [Install] WantedBy=multi-user.target