Skip to content

Commit c3aad97

Browse files
authored
Merge pull request #50 from sorenisanerd/dev
Merge dev branch
2 parents e6f2567 + 281b6fd commit c3aad97

File tree

87 files changed

+2521
-910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+2521
-910
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@ jobs:
4141
dl/mangos.tools_*.tar.zst
4242
- name: Decompress and stage tools
4343
run: mkdir mkosi.tools ; tar -x --zstd -f dl/mangos.tools_*.tar.zst -C mkosi.tools
44+
- uses: dsaltares/fetch-gh-release-asset@master
45+
id: pkgs-fetch
46+
with:
47+
repo: ${{ github.repository_owner }}/mangos-tools
48+
version: latest
49+
file: 'mangos-packages_.*\.tar\.zst.*'
50+
regex: true
51+
target: 'dl/'
52+
- name: Verify packages signature
53+
env:
54+
tag: ${{ steps.pkgs-fetch.outputs.version }}
55+
run: |
56+
cosign verify-blob --bundle dl/mangos-packages_*.tar.zst.sigbundle \
57+
--certificate-identity "${{ github.server_url }}/${{ github.repository_owner }}/mangos-tools/.github/workflows/build.yml@refs/tags/${tag}" \
58+
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
59+
dl/mangos-packages_*.tar.zst
60+
- name: Decompress and stage packages
61+
run: mkdir mkosi.packages ; tar -x --zstd -f dl/mangos-packages_*.tar.zst -C mkosi.packages
4462
- name: Inject key and cert
4563
env:
4664
MANGOS_CERT: ${{ vars.MANGOS_CERT }}
@@ -60,12 +78,15 @@ jobs:
6078
cat <<EOF > mkosi.key
6179
$MANGOS_KEY
6280
EOF
81+
- name: Download Hashistack
82+
run: |
83+
./hashiext-download.sh
6384
- name: Run mkosi
6485
env:
6586
profiles: ${{ matrix.profiles }}
6687
MANGOS_GITHUB_URL: ${{ github.server_url }}/${{ github.repository }}
6788
run: |
68-
mkosi -E RUNNER_ENVIRONMENT --debug --profile= --profile="${profiles}"
89+
mkosi -E RUNNER_ENVIRONMENT --debug --profile= --profile="${profiles},hashistack"
6990
mkosi -E RUNNER_ENVIRONMENT --debug --profile= --profile="${profiles},installer"
7091
- name: List built artifacts
7192
run: find out/

.github/workflows/pr.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,37 @@ jobs:
3838
dl/mangos.tools_*.tar.zst
3939
- name: Decompress and stage tools
4040
run: mkdir mkosi.tools ; tar -x --zstd -f dl/mangos.tools_*.tar.zst -C mkosi.tools
41+
- uses: dsaltares/fetch-gh-release-asset@master
42+
id: pkgs-fetch
43+
with:
44+
repo: ${{ github.repository_owner }}/mangos-tools
45+
version: latest
46+
file: 'mangos-packages_.*\.tar\.zst.*'
47+
regex: true
48+
target: 'dl/'
49+
- name: Verify packages signature
50+
env:
51+
tag: ${{ steps.pkgs-fetch.outputs.version }}
52+
run: |
53+
cosign verify-blob --bundle dl/mangos-packages_*.tar.zst.sigbundle \
54+
--certificate-identity "${{ github.server_url }}/${{ github.repository_owner }}/mangos-tools/.github/workflows/build.yml@refs/tags/${tag}" \
55+
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
56+
dl/mangos-packages_*.tar.zst
57+
- name: Decompress and stage packages
58+
run: mkdir mkosi.packages ; tar -x --zstd -f dl/mangos-packages_*.tar.zst -C mkosi.packages
4159
- name: Generate key
4260
run: |
4361
#!/bin/sh
4462
mkosi genkey
63+
- name: Download Hashistack
64+
run: |
65+
./hashiext-download.sh
4566
- name: Run mkosi
4667
env:
4768
profiles: ${{ matrix.profiles }}
4869
MANGOS_GITHUB_URL: ${{ github.server_url }}/${{ github.repository }}
4970
run: |
50-
mkosi -E RUNNER_ENVIRONMENT --debug --profile= --profile="${profiles}"
71+
mkosi -E RUNNER_ENVIRONMENT --debug --profile= --profile="${profiles},hashistack"
5172
mkosi -E RUNNER_ENVIRONMENT --debug --profile= --profile="${profiles},installer"
5273
- name: List built artifacts
5374
run: find out/

hashiext-download.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
VAULT_VERSION=${VAULT_VERSION:-latest}
4+
CONSUL_VERSION=${CONSUL_VERSION:-latest}
5+
NOMAD_VERSION=${NOMAD_VERSION:-latest}
6+
CONSUL_TEMPLATE_VERSION=${CONSUL_TEMPLATE_VERSION:-latest}
7+
TERRAFORM_VERSION=${TERRAFORM_VERSION:-latest}
8+
9+
get_latest_version() {
10+
curl -s "https://api.github.com/repos/hashicorp/$1/releases/latest" | jq .name -r
11+
}
12+
13+
download() {
14+
local name="$1"
15+
local version="$2"
16+
17+
if [ "${version}" = "latest" ]; then
18+
version=$(get_latest_version "$name")
19+
fi
20+
21+
version="${version#v}"
22+
23+
origdir="$(pwd)"
24+
tmpdir=$(mktemp -d)
25+
cd "$tmpdir" || exit 1
26+
27+
local url="https://releases.hashicorp.com/${name}/${version}/${name}_${version}_linux_amd64.zip"
28+
local fname="${url##*/}"
29+
wget -O "${fname}" "${url}"
30+
31+
sha256sums=https://releases.hashicorp.com/${name}/${version}/${name}_${version}_SHA256SUMS
32+
sha256sums_sig=https://releases.hashicorp.com/${name}/${version}/${name}_${version}_SHA256SUMS.sig
33+
34+
wget -O SHA256SUMS "${sha256sums}"
35+
wget -O SHA256SUMS.sig "${sha256sums_sig}"
36+
37+
if ! gpg --verify --no-default-keyring --keyring ${origdir}/resources/hashicorp-signing-key.72D7468F.gpg SHA256SUMS.sig SHA256SUMS
38+
then
39+
echo "GPG signature verification failed!"
40+
exit 1
41+
fi
42+
43+
echo "Verifying checksums..."
44+
if ! grep -E "${fname}$" SHA256SUMS | sha256sum -c
45+
then
46+
echo "Checksum verification failed!"
47+
exit 1
48+
fi
49+
mv "${fname}" "${origdir}"
50+
cd "${origdir}"
51+
rm -rf "${tmpdir}"
52+
}
53+
54+
for tool in terraform vault nomad consul consul-template ; do
55+
v="${tool^^}_VERSION"
56+
v="${v//-/_}"
57+
mkdir -p mkosi.images/${tool}/bin
58+
if [ -f "mkosi.images/${tool}/bin/${tool}" ]
59+
then
60+
echo "Binary mkosi.images/${tool}/bin/${tool} already exists, skipping download/unzip"
61+
continue
62+
fi
63+
download "$tool" "${!v}"
64+
unzip ${tool}_*.zip -d mkosi.images/${tool}/bin ${tool}
65+
done

mkosi.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Environment=MANGOS_GITHUB_URL
3131

3232
[Config]
3333
Profiles=verity-full,secureboot
34+
Dependencies=initrd,base
3435

3536
[Include]
3637
Include=%D/resources/common-kernel

mkosi.images/base/mkosi.conf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,18 @@ Packages=
6060

6161
gdisk
6262
pciutils
63-
lshw
63+
curl
64+
jq
6465

6566
ExtraTrees=%D/sshd-keygen:/usr/lib/sshd-keygen
6667
%D/[email protected]:/usr/lib/systemd/system/
6768
%D/sshd-keygen.target:/usr/lib/systemd/system/
6869
%D/resources/sysupdate.d:/usr/lib/sysupdate.d
70+
%D/resources/mangosctl.sh:/usr/bin/mangosctl
6971
%D/mangos-sd-gh-proxy.py:/usr/bin/mangos-sd-gh-proxy
72+
%D/resources/sysupdate.consul.d:/usr/lib/sysupdate.consul.d
73+
%D/resources/sysupdate.consul-template.d:/usr/lib/sysupdate.consul-template.d
74+
%D/resources/sysupdate.nomad.d:/usr/lib/sysupdate.nomad.d
75+
%D/resources/sysupdate.terraform.d:/usr/lib/sysupdate.terraform.d
76+
%D/resources/sysupdate.vault.d:/usr/lib/sysupdate.vault.d
7077

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Match]
2+
Profiles=hashistack
3+
4+
[Content]
5+
ExtraTrees=%D/resources/mangosctl.sh:/usr/bin/mangosctl
6+
%D/resources/sysupdate.consul.d:/usr/lib/sysupdate.consul.d
7+
%D/resources/sysupdate.consul-template.d:/usr/lib/sysupdate.consul-template.d
8+
%D/resources/sysupdate.nomad.d:/usr/lib/sysupdate.nomad.d
9+
%D/resources/sysupdate.terraform.d:/usr/lib/sysupdate.terraform.d
10+
%D/resources/sysupdate.vault.d:/usr/lib/sysupdate.vault.d
11+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node-????-????

mkosi.images/base/mkosi.extra/usr/lib/repart.d/40-var-tmp.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
Type=tmp
33
Format=xfs
44
Encrypt=tpm2
5-
SizeMinBytes=5G
5+
SizeMinBytes=2G
6+
SizeMaxBytes=4G
67
FactoryReset=on

mkosi.images/base/mkosi.extra/usr/lib/sysusers.d/mangos-docker.conf

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# 0-99 are centrally allocated by Debian(/Ubuntu)
2+
# 100-999 are "dynamically allocated system ids". We start at 501.
3+
#Type Name ID GECOS Home directory Shell
4+
g docker 501 -
5+
u nomad 502 Nomad /var/lib/nomad /bin/false
6+
u vault 503 Vault /var/lib/vault /bin/false
7+
u consul 504 Consul /var/lib/consul /bin/false

0 commit comments

Comments
 (0)