Skip to content

Commit 9e895c2

Browse files
committed
fix: reference supabase postgres flake through flakeref instead of local path
also postpone nix cleanup to after sbom generation, in order to leverage the existing nix derivations in /nix/store
1 parent c6118ad commit 9e895c2

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

ebssurrogate/scripts/nix-provision.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ function execute_stage2_playbook {
6666
$ARGS
6767
}
6868

69+
function generate_and_upload_sbom {
70+
nix run github:supabase/postgres#ubuntu-sbom -- --nix-target /nix/var/nix/profiles/default --include-files --no-progress --output /tmp/ami-system-sbom.json
71+
}
72+
6973
function cleanup_packages {
7074
apt-get remove --purge --yes ansible
7175
}
@@ -79,7 +83,6 @@ function report_packages {
7983
# shellcheck disable=SC2016
8084
dpkg-query -W -f='${Package}\t${Version}\t${Architecture}\n' | LC_COLLATE=C.UTF-8 sort
8185
find /nix/store -maxdepth 1 | LC_COLLATE=C.UTF-8 sort -t- -k2
82-
nix run .#ubuntu-sbom -- --nix-target /nix/var/nix/profiles/default --include-files --no-progress --output /tmp/ami-system-sbom.json
8386
}
8487

8588
function report_disk_usage {
@@ -93,9 +96,10 @@ update_and_upgrade_apt
9396
install_packages
9497
install_nix
9598
execute_stage2_playbook
99+
generate_and_upload_sbom
96100
cleanup_packages
97-
cleanup_nix
98101
update_and_upgrade_apt
99102
cleanup_apt
100103
report_packages
104+
cleanup_nix
101105
report_disk_usage

ebssurrogate/scripts/qemu-bootstrap-nix.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ function execute_stage2_playbook {
162162
--extra-vars @./ansible/qemu-vars.yaml
163163
}
164164

165+
166+
function generate_and_upload_sbom {
167+
nix run github:supabase/postgres#ubuntu-sbom -- --nix-target /nix/var/nix/profiles/default --include-files --no-progress --output /tmp/ami-system-sbom.json
168+
}
169+
165170
function clean_legacy_things {
166171
# removes things that are bundled for legacy reasons, but we can start without for our newer artifacts
167172
apt-mark auto zlib1g* # TODO (darora): need to make sure that there aren't other things that still need this
@@ -268,6 +273,7 @@ execute_playbook
268273

269274
install_nix
270275
execute_stage2_playbook
276+
generate_and_upload_sbom
271277
clean_legacy_things
272278
clean_system
273279
clean_nix

nix/apps.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
cli-smoke-test = mkApp "cli-smoke-test";
3535
ubuntu-sbom = {
3636
type = "app";
37-
program = "${self'.packages.ubuntu-sbom}/bin/ubuntu-sbom";
37+
program = "${self'.packages.sbom}/bin/ubuntu-sbom";
3838
};
3939
};
4040
};

nix/packages/default.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@
120120
inherit (pkgs) yq;
121121
postgresql_15 = self'.packages."postgresql_15";
122122
};
123-
ubuntu-sbom =
124-
inputs.ubuntu-nix-sbom.packages.${pkgs.stdenv.hostPlatform.system}.ubuntu-sbom-generator;
123+
sbom = inputs.ubuntu-nix-sbom.packages.${pkgs.stdenv.hostPlatform.system}.sbom;
125124
inherit (pkgs.callPackage ./wal-g.nix { }) wal-g-2 wal-g-3;
126125
inherit (supascan-pkgs) goss supascan supascan-specs;
127126
inherit (pg-startup-profiler-pkgs) pg-startup-profiler;

0 commit comments

Comments
 (0)