diff --git a/.github/workflows/offline.yml b/.github/workflows/offline.yml index ecc9b3957..b08c3994a 100644 --- a/.github/workflows/offline.yml +++ b/.github/workflows/offline.yml @@ -16,6 +16,13 @@ # # Push to master/develop: Always builds all profiles regardless of labels # +# Manual builds (workflow_dispatch), e.g. for a release candidate in wire-builds: +# gh workflow run offline.yml --ref -f profile=min -f wire_build_ref= +# - 'profile' selects the profiles like the labels above +# - 'wire_build_ref' selects the build.json from wireapp/wire-builds (empty: script default) +# - bundles are uploaded to S3 as wire-server-deploy-static[-]--wire-builds-.tgz +# and attached to the run (kept 14 days) +# on: push: branches: ["**"] @@ -29,12 +36,31 @@ on: paths-ignore: - "*.md" - "**/*.md" + workflow_dispatch: + inputs: + profile: + description: "Profile(s) to build (same meaning as the build-* PR labels)" + type: choice + options: [min, default, dev, wiab-staging, all] + default: min + wire_build_ref: + description: "wireapp/wire-builds commit, branch or tag to take build.json from (empty: default of proc_pull_charts.sh)" + type: string + required: false + default: "" + +env: + # build.json URL for workflow_dispatch builds; empty otherwise (the scripts then use their default) + WIRE_BUILD: ${{ inputs.wire_build_ref != '' && format('https://raw.githubusercontent.com/wireapp/wire-builds/{0}/build.json', inputs.wire_build_ref) || '' }} + WIRE_BUILD_REF: ${{ inputs.wire_build_ref }} + jobs: # Build default profile and create local assets build-default: name: Build default profile if: | (github.event_name == 'push' && github.ref == 'refs/heads/master') || + (github.event_name == 'workflow_dispatch' && (inputs.profile == 'all' || inputs.profile == 'default' || inputs.profile == 'wiab-staging')) || contains(github.event.pull_request.labels.*.name, 'build-all') || contains(github.event.pull_request.labels.*.name, 'build-default') || contains(github.event.pull_request.labels.*.name, 'build-wiab-staging') @@ -57,14 +83,22 @@ jobs: - name: Get upload name id: upload_name - run: echo "UPLOAD_NAME=$GITHUB_SHA" >> $GITHUB_OUTPUT + run: | + name="$GITHUB_SHA" + if [[ -n "$WIRE_BUILD_REF" ]]; then + name="${name}-wire-builds-$(printf '%s' "$WIRE_BUILD_REF" | tr -c 'A-Za-z0-9._-' '-' | cut -c1-64)" + fi + echo "UPLOAD_NAME=$name" >> "$GITHUB_OUTPUT" # default profile build - name: Process the default profile build run: ./offline/default-build/build.sh env: GPG_PRIVATE_KEY: '${{ secrets.GPG_PRIVATE_KEY }}' - DOCKER_LOGIN: '${{ secrets.DOCKER_LOGIN }}' + # read-only robot for pulling helm charts (OCI) and container images from quay.io + DOCKER_LOGIN: '${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_USERNAME }}:${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_PASSWORD }}' + OCI_REGISTRY_USERNAME: '${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_USERNAME }}' + OCI_REGISTRY_PASSWORD: '${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_PASSWORD }}' - name: Copy default build assets tarball to S3 run: | @@ -75,11 +109,29 @@ jobs: AWS_SECRET_ACCESS_KEY: '${{ secrets.AWS_SECRET_ACCESS_KEY }}' AWS_REGION: "eu-west-1" + # Manual builds are handed out to people: also attach the bundle to the run + # (as a plain .tgz, not zipped). S3 stays the permanent copy. + - name: Name default bundle for attaching to the run + if: github.event_name == 'workflow_dispatch' + run: ln -f "offline/default-build/output/assets.tgz" "offline/default-build/output/wire-server-deploy-static-${UPLOAD_NAME}.tgz" + env: + UPLOAD_NAME: ${{ steps.upload_name.outputs.UPLOAD_NAME }} + + - name: Attach default bundle to the run + if: github.event_name == 'workflow_dispatch' + uses: actions/upload-artifact@v7 + with: + path: offline/default-build/output/wire-server-deploy-static-${{ steps.upload_name.outputs.UPLOAD_NAME }}.tgz + archive: false + retention-days: 14 + if-no-files-found: error + verify-default: name: Verify default profile needs: build-default if: | (github.event_name == 'push' && github.ref == 'refs/heads/master') || + (github.event_name == 'workflow_dispatch' && (inputs.profile == 'all' || inputs.profile == 'default')) || contains(github.event.pull_request.labels.*.name, 'build-all') || contains(github.event.pull_request.labels.*.name, 'build-default') runs-on: @@ -108,6 +160,7 @@ jobs: run: ./offline/cd.sh env: HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}' + COMMIT_HASH: ${{ needs.build-default.outputs.upload_name }} - name: Clean up hetzner environment; just in case # Skip when terraform was never installed (earlier step failed): nothing was deployed. @@ -122,6 +175,7 @@ jobs: needs: build-default if: | (github.event_name == 'push' && github.ref == 'refs/heads/master') || + (github.event_name == 'workflow_dispatch' && (inputs.profile == 'all' || inputs.profile == 'wiab-staging')) || contains(github.event.pull_request.labels.*.name, 'build-all') || contains(github.event.pull_request.labels.*.name, 'build-wiab-staging') runs-on: @@ -150,6 +204,7 @@ jobs: run: ./offline/cd_staging.sh env: HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}' + COMMIT_HASH: ${{ needs.build-default.outputs.upload_name }} - name: Clean up hetzner wiab-staging environment; just in case # Skip when terraform was never installed (earlier step failed): nothing was deployed. @@ -188,6 +243,7 @@ jobs: name: Build dev profile if: | (github.event_name == 'push' && github.ref == 'refs/heads/master') || + (github.event_name == 'workflow_dispatch' && (inputs.profile == 'all' || inputs.profile == 'dev')) || contains(github.event.pull_request.labels.*.name, 'build-all') || contains(github.event.pull_request.labels.*.name, 'build-dev') runs-on: @@ -207,13 +263,21 @@ jobs: - name: Get upload name id: upload_name - run: echo "UPLOAD_NAME=$GITHUB_SHA" >> $GITHUB_OUTPUT + run: | + name="$GITHUB_SHA" + if [[ -n "$WIRE_BUILD_REF" ]]; then + name="${name}-wire-builds-$(printf '%s' "$WIRE_BUILD_REF" | tr -c 'A-Za-z0-9._-' '-' | cut -c1-64)" + fi + echo "UPLOAD_NAME=$name" >> "$GITHUB_OUTPUT" - name: Process the dev profile build run: ./offline/demo-build/build.sh env: GPG_PRIVATE_KEY: "${{ secrets.GPG_PRIVATE_KEY }}" - DOCKER_LOGIN: "${{ secrets.DOCKER_LOGIN }}" + # read-only robot for pulling helm charts (OCI) and container images from quay.io + DOCKER_LOGIN: "${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_USERNAME }}:${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_PASSWORD }}" + OCI_REGISTRY_USERNAME: "${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_USERNAME }}" + OCI_REGISTRY_PASSWORD: "${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_PASSWORD }}" - name: Copy dev build assets tarball to S3 run: | @@ -224,6 +288,23 @@ jobs: AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" AWS_REGION: "eu-west-1" + # Manual builds are handed out to people: also attach the bundle to the run + # (as a plain .tgz, not zipped). S3 stays the permanent copy. + - name: Name dev bundle for attaching to the run + if: github.event_name == 'workflow_dispatch' + run: ln -f "offline/demo-build/output/assets.tgz" "offline/demo-build/output/wire-server-deploy-static-demo-${UPLOAD_NAME}.tgz" + env: + UPLOAD_NAME: ${{ steps.upload_name.outputs.UPLOAD_NAME }} + + - name: Attach dev bundle to the run + if: github.event_name == 'workflow_dispatch' + uses: actions/upload-artifact@v7 + with: + path: offline/demo-build/output/wire-server-deploy-static-demo-${{ steps.upload_name.outputs.UPLOAD_NAME }}.tgz + archive: false + retention-days: 14 + if-no-files-found: error + - name: Install terraform id: install-terraform uses: hashicorp/setup-terraform@v3 @@ -235,6 +316,7 @@ jobs: run: ./offline/cd_demo.sh env: HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}' + COMMIT_HASH: ${{ steps.upload_name.outputs.UPLOAD_NAME }} - name: Clean up hetzner wiab environment; just in case # Skip when terraform was never installed (earlier step failed): nothing was deployed. @@ -251,6 +333,7 @@ jobs: name: Build min profile if: | (github.event_name == 'push' && github.ref == 'refs/heads/master') || + (github.event_name == 'workflow_dispatch' && (inputs.profile == 'all' || inputs.profile == 'min')) || contains(github.event.pull_request.labels.*.name, 'build-all') || contains(github.event.pull_request.labels.*.name, 'build-min') runs-on: @@ -270,13 +353,21 @@ jobs: - name: Get upload name id: upload_name - run: echo "UPLOAD_NAME=$GITHUB_SHA" >> $GITHUB_OUTPUT + run: | + name="$GITHUB_SHA" + if [[ -n "$WIRE_BUILD_REF" ]]; then + name="${name}-wire-builds-$(printf '%s' "$WIRE_BUILD_REF" | tr -c 'A-Za-z0-9._-' '-' | cut -c1-64)" + fi + echo "UPLOAD_NAME=$name" >> "$GITHUB_OUTPUT" - name: Process the min profile build run: ./offline/min-build/build.sh env: GPG_PRIVATE_KEY: "${{ secrets.GPG_PRIVATE_KEY }}" - DOCKER_LOGIN: "${{ secrets.DOCKER_LOGIN }}" + # read-only robot for pulling helm charts (OCI) and container images from quay.io + DOCKER_LOGIN: "${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_USERNAME }}:${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_PASSWORD }}" + OCI_REGISTRY_USERNAME: "${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_USERNAME }}" + OCI_REGISTRY_PASSWORD: "${{ secrets.QUAY_WIRE_ALL_REPOS_READONLY_PASSWORD }}" - name: Copy min build assets tarball to S3 run: | @@ -287,5 +378,22 @@ jobs: AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" AWS_REGION: "eu-west-1" + # Manual builds are handed out to people: also attach the bundle to the run + # (as a plain .tgz, not zipped). S3 stays the permanent copy. + - name: Name min bundle for attaching to the run + if: github.event_name == 'workflow_dispatch' + run: ln -f "offline/min-build/output/assets.tgz" "offline/min-build/output/wire-server-deploy-static-min-${UPLOAD_NAME}.tgz" + env: + UPLOAD_NAME: ${{ steps.upload_name.outputs.UPLOAD_NAME }} + + - name: Attach min bundle to the run + if: github.event_name == 'workflow_dispatch' + uses: actions/upload-artifact@v7 + with: + path: offline/min-build/output/wire-server-deploy-static-min-${{ steps.upload_name.outputs.UPLOAD_NAME }}.tgz + archive: false + retention-days: 14 + if-no-files-found: error + - name: Cleanup min build assets run: rm -rf offline/min-build/output/ diff --git a/ansible/inventory/offline/group_vars/postgresql/postgresql.yml b/ansible/inventory/offline/group_vars/postgresql/postgresql.yml index 1e4d19920..170355fbb 100644 --- a/ansible/inventory/offline/group_vars/postgresql/postgresql.yml +++ b/ansible/inventory/offline/group_vars/postgresql/postgresql.yml @@ -53,7 +53,7 @@ postgresql_use_repository: false # Set to true to use local packages from urls # When updating the packages, update the checksums too in wire-server-deploy/nix/pkgs/wire-binaries.nix postgresql_pkgs: - name: libpq5 - url: "{{ binaries_url }}/libpq5_18.2-1.pgdg22.04+1_amd64.deb" + url: "{{ binaries_url }}/libpq5_18.3-1.pgdg22.04+1_amd64.deb" checksum: "sha256:54e4ab2606aea5525bfd1a99b6e1b143458caced07bd840ccb46a69cad61f341" - name: postgresql-client-common url: "{{ binaries_url }}/postgresql-client-common_291.pgdg22.04+1_all.deb" @@ -62,11 +62,11 @@ postgresql_pkgs: url: "{{ binaries_url }}/postgresql-common_291.pgdg22.04+1_all.deb" checksum: "sha256:4c51fd323be440de831a55b1f06da77ba6e803fdf47a8b8e3e99b4f439256683" - name: postgresql-client-17 - url: "{{ binaries_url }}/postgresql-client-17_17.8-1.pgdg22.04+1_amd64.deb" - checksum: "sha256:a83a985f1e406c1914212de5dffdcce277d3d82ae5d542dd9d84001a97a427e4" + url: "{{ binaries_url }}/postgresql-client-17_17.9-1.pgdg22.04+1_amd64.deb" + checksum: "sha256:941afbc8e2a3396281cc4877ceb35c767f4638bd731b66ec8edf1fd56d30a538" - name: postgresql-17 - url: "{{ binaries_url }}/postgresql-17_17.8-1.pgdg22.04+1_amd64.deb" - checksum: "sha256:bddeaf93563ecf60df46b2000fd4d519d346d811579f89f30387de8d58f9b0dd" + url: "{{ binaries_url }}/postgresql-17_17.9-1.pgdg22.04+1_amd64.deb" + checksum: "sha256:69a65391f4ec1eac6a64b6f9c4bd31406f5ce5250cb669a5d00bd59f2d1e9e79" - name: python3-psycopg2 url: "{{ binaries_url }}/python3-psycopg2_2.9.10-1.pgdg22.04+1_amd64.deb" checksum: "sha256:cc2f749e3af292a67e012edeb4aa5d284f57f2d66a9a09fe5b81e5ffda73cab4" @@ -78,4 +78,4 @@ postgresql_pkgs: checksum: "sha256:f4efae9acf2fbfb5f5af43b8b812e2925d611fca1c48925276abc64116766128" - name: postgresql-17-repmgr url: "{{ binaries_url }}/postgresql-17-repmgr_5.5.0+debpgdg-3.pgdg22.04+1_amd64.deb" - checksum: "sha256:d8c2d333d7444b88a28f9f1cc8cf351a1120b8856a26940b21e256f80deefd84" \ No newline at end of file + checksum: "sha256:06dbcee7e5430a50e71aee28aa83b6aad0325756b67390831f7dbfa5839c9630" diff --git a/changelog.d/2-wire-builds/build-json-2026-q4 b/changelog.d/2-wire-builds/build-json-2026-q4 new file mode 100644 index 000000000..c5a7db503 --- /dev/null +++ b/changelog.d/2-wire-builds/build-json-2026-q4 @@ -0,0 +1 @@ +Changed: source helm charts from the wire-builds 2026-q4-from-rm build.json (Bund Q4, OCI charts) diff --git a/changelog.d/2-wire-builds/helm-oci-charts b/changelog.d/2-wire-builds/helm-oci-charts new file mode 100644 index 000000000..427fc282c --- /dev/null +++ b/changelog.d/2-wire-builds/helm-oci-charts @@ -0,0 +1 @@ +Added: support oci:// helm chart references in build.json (pulled by full reference, authenticated via OCI_REGISTRY_USERNAME/OCI_REGISTRY_PASSWORD), extract every chart to charts/, and allow overriding the build.json source via WIRE_BUILD diff --git a/changelog.d/2-wire-builds/helm-oci-dependency b/changelog.d/2-wire-builds/helm-oci-dependency new file mode 100644 index 000000000..148f092f1 --- /dev/null +++ b/changelog.d/2-wire-builds/helm-oci-dependency @@ -0,0 +1 @@ +Changed: Updated nix pkgs for OCI helm charts diff --git a/changelog.d/3-deploy-builds/offline-workflow-dispatch b/changelog.d/3-deploy-builds/offline-workflow-dispatch new file mode 100644 index 000000000..9d83cc1d2 --- /dev/null +++ b/changelog.d/3-deploy-builds/offline-workflow-dispatch @@ -0,0 +1 @@ +Added: the offline workflow can be started manually (workflow_dispatch) with a profile and a wire-builds ref, to build bundles for any build.json without committing to wire-server-deploy; manual builds also attach the bundle to the run (kept 14 days) diff --git a/default.nix b/default.nix index fb0468cfc..8177b78ca 100644 --- a/default.nix +++ b/default.nix @@ -3,12 +3,12 @@ let sources = import ./nix/sources.nix; # for injecting old gnupg dependancy - oldpkgs = import sources.oldpkgs { - inherit system; - config = { }; - }; + #oldpkgs = import sources.oldpkgs { + # inherit system; + # config = { }; + #}; # extract the module for injecting - gnupg1orig = oldpkgs.gnupg1orig; + #gnupg1orig = oldpkgs.gnupg1orig; pkgs = import sources.nixpkgs { inherit system; @@ -21,9 +21,9 @@ let # layering is important here, the lowest takes precedance in case of overlaps overlays = [ # custom overlay for injections - (self: super: { - gnupg1orig = gnupg1orig; - }) + # (self: super: { + # gnupg1orig = gnupg1orig; + # }) # main overlay (import ./nix/overlay.nix) ]; @@ -49,9 +49,9 @@ rec { apacheHttpd awscli2 gnumake - gnupg1 + gnupg # injected dependacy gnupg1orig - gnupg1orig + # gnupg1orig kubernetes-tools @@ -78,6 +78,9 @@ rec { gnused curl gawk + oras + # Hetzner Cloud CLI, for debugging the offline CD environment (offline/cd.sh) + hcloud niv nix-prefetch-docker @@ -127,4 +130,4 @@ rec { ]; }; }; -} +} \ No newline at end of file diff --git a/nix/overlay.nix b/nix/overlay.nix index b5d27bca9..51b54859d 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -1,22 +1,27 @@ self: let helm-mapkubeapis = self.callPackage ./pkgs/helm-mapkubeapis.nix { }; + sources = import ./sources.nix; + # for injecting old gnupg dependancy + oldpkgs = import sources.oldpkgs { + config = { }; + }; in super: { - customAnsible = (self.python3.withPackages (_: self.ansible.requiredPythonModules ++ [ - # due to ansible package from nixpkgs missing some dependancies to run kubespray playbook - # we are making our own custom ansible package and python interpreter, current ansible-core is 2.16.5 - super.python3Packages.ansible-core - # DEPENDENCIES - super.python3Packages.jmespath - super.python3Packages.botocore - super.python3Packages.boto3 - super.python3Packages.cryptography - super.python3Packages.six - # for packet debugging and reporting. - super.python3Packages.pyshark - super.python3Packages.matplotlib - ])); + # due to ansible package from nixpkgs missing some dependancies to run kubespray playbook + # we are making our own custom ansible package and python interpreter, current ansible-core is 2.16.5 + customAnsible = oldpkgs.python3.withPackages (_: + oldpkgs.ansible.requiredPythonModules ++ [ + oldpkgs.python3Packages.ansible-core + + oldpkgs.python3Packages.jmespath + oldpkgs.python3Packages.botocore + oldpkgs.python3Packages.boto3 + oldpkgs.python3Packages.cryptography + oldpkgs.python3Packages.six + oldpkgs.python3Packages.pyshark + oldpkgs.python3Packages.matplotlib + ]); # kubeadm and kubectl kubernetes-tools = self.callPackage ./pkgs/kubernetes-tools.nix { }; @@ -43,7 +48,7 @@ super: { install -Dm755 ${./scripts/generate-gpg1-key.sh} $out/bin/generate-gpg1-key # we *--set* PATH here, to ensure we don't pick wrong gpgs - wrapProgram $out/bin/generate-gpg1-key --set PATH '${super.lib.makeBinPath (with self; [ bash coreutils gnupg1orig ])}' + wrapProgram $out/bin/generate-gpg1-key --set PATH '${super.lib.makeBinPath (with self; [ bash coreutils ])}' ''; mirror-apt-jammy = super.runCommandNoCC "mirror-apt-jammy" { @@ -52,7 +57,7 @@ super: { '' install -Dm755 ${./scripts/mirror-apt-jammy.sh} $out/bin/mirror-apt-jammy # we need to *--set* PATH here, otherwise aptly will pick the wrong gpg - wrapProgram $out/bin/mirror-apt-jammy --set PATH '${super.lib.makeBinPath (with self; [ aptly bash coreutils curl gnupg1orig gnused gnutar ])}' + wrapProgram $out/bin/mirror-apt-jammy --set PATH '${super.lib.makeBinPath (with self; [ aptly bash coreutils curl gnupg gnused gnutar ])}' ''; create-container-dump = super.runCommandNoCC "create-container-dump" @@ -82,4 +87,4 @@ super: { wrapProgram $out/bin/create-build-entry --prefix PATH : '${super.lib.makeBinPath (with self; [ bash jq ])}' ''; -} \ No newline at end of file +} diff --git a/nix/pkgs/wire-binaries.nix b/nix/pkgs/wire-binaries.nix index 490f9f4ef..1424a31d8 100644 --- a/nix/pkgs/wire-binaries.nix +++ b/nix/pkgs/wire-binaries.nix @@ -110,18 +110,18 @@ let # when updating the packages, update the checksums too in wire-server-deploy/ansible/inventory/offline/group_vars/all/offline.yml postgresql = fetchurl rec { passthru.url = url; - url = "https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-17/postgresql-17_17.8-1.pgdg22.04+1_amd64.deb"; - sha256 = "sha256:bddeaf93563ecf60df46b2000fd4d519d346d811579f89f30387de8d58f9b0dd"; + url = "https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-17/postgresql-17_17.9-1.pgdg22.04+1_amd64.deb"; + sha256 = "sha256:69a65391f4ec1eac6a64b6f9c4bd31406f5ce5250cb669a5d00bd59f2d1e9e79"; }; postgresql-client = fetchurl rec { passthru.url = url; - url = "https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-17/postgresql-client-17_17.8-1.pgdg22.04+1_amd64.deb"; - sha256 = "sha256:a83a985f1e406c1914212de5dffdcce277d3d82ae5d542dd9d84001a97a427e4"; + url = "https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-17/postgresql-client-17_17.9-1.pgdg22.04+1_amd64.deb"; + sha256 = "sha256:941afbc8e2a3396281cc4877ceb35c767f4638bd731b66ec8edf1fd56d30a538"; }; libpq5 = fetchurl rec { passthru.url = url; - url = "https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-18/libpq5_18.2-1.pgdg22.04+1_amd64.deb"; - sha256 = "sha256:54e4ab2606aea5525bfd1a99b6e1b143458caced07bd840ccb46a69cad61f341"; + url = "https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-18/libpq5_18.3-1.pgdg22.04+1_amd64.deb"; + sha256 = "sha256:06dbcee7e5430a50e71aee28aa83b6aad0325756b67390831f7dbfa5839c9630"; }; postgresql-client-common = fetchurl rec { passthru.url = url; @@ -166,4 +166,4 @@ runCommandNoCC "wire-binaries" } '' mkdir -p $out ${toString (lib.mapAttrsToList (k: v: "cp ${v} $out/${baseNameOf v.url}\n") srcs)} -'' \ No newline at end of file +'' diff --git a/nix/scripts/mirror-apt-jammy.sh b/nix/scripts/mirror-apt-jammy.sh index b75d5778f..fb5057687 100755 --- a/nix/scripts/mirror-apt-jammy.sh +++ b/nix/scripts/mirror-apt-jammy.sh @@ -113,7 +113,7 @@ aptly_config=$(mktemp) trap 'rm -Rf -- "$aptly_config $GNUPGHOME"' EXIT cat > "$aptly_config" < "$aptly_root/public/gpg" diff --git a/nix/sources.json b/nix/sources.json index d9f443988..e0a0cc7d0 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,10 +5,10 @@ "homepage": "https://github.com/nmattia/niv", "owner": "nmattia", "repo": "niv", - "rev": "9cb7ef336bb71fd1ca84fc7f2dff15ef4b033f2a", - "sha256": "1ajyqr8zka1zlb25jx1v4xys3zqmdy3prbm1vxlid6ah27a8qnzh", + "rev": "1ad9d90fea53b0e794cdbabf5515b39e539bc148", + "sha256": "1abhp43jpr8iaixyflr86zzj8ps0v8xzax301ilsvp07w3h23dwz", "type": "tarball", - "url": "https://github.com/nmattia/niv/archive/9cb7ef336bb71fd1ca84fc7f2dff15ef4b033f2a.tar.gz", + "url": "https://github.com/nmattia/niv/archive/1ad9d90fea53b0e794cdbabf5515b39e539bc148.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { @@ -17,10 +17,10 @@ "homepage": "https://github.com/NixOS/nixpkgs", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0da3c44a9460a26d2025ec3ed2ec60a895eb1114", - "sha256": "1n435wya14pbl04g6n4zrqaslpik4xq0fv1i2g2mz8sq3dqg7dk0", + "rev": "7901e285e8b54a2f0e51ce6183980738447130e5", + "sha256": "1gdwfkqy7zich82dzxzjcsi613zm7p8cigj2fzqsagn63f5g0pnr", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/0da3c44a9460a26d2025ec3ed2ec60a895eb1114.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/7901e285e8b54a2f0e51ce6183980738447130e5.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "oldpkgs": { @@ -29,10 +29,10 @@ "homepage": "https://github.com/NixOS/nixpkgs", "owner": "NixOS", "repo": "nixpkgs", - "rev": "057f9aecfb71c4437d2b27d3323df7f93c010b7e", - "sha256": "1ndiv385w1qyb3b18vw13991fzb9wg4cl21wglk89grsfsnra41k", + "rev": "0da3c44a9460a26d2025ec3ed2ec60a895eb1114", + "sha256": "1n435wya14pbl04g6n4zrqaslpik4xq0fv1i2g2mz8sq3dqg7dk0", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/057f9aecfb71c4437d2b27d3323df7f93c010b7e.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/0da3c44a9460a26d2025ec3ed2ec60a895eb1114.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/offline/cd.sh b/offline/cd.sh index a67e9f211..93d3f5e2e 100755 --- a/offline/cd.sh +++ b/offline/cd.sh @@ -7,7 +7,8 @@ TF_DIR="${CD_DIR}/../terraform/examples/wire-server-deploy-offline-hetzner" VALUES_DIR="${CD_DIR}/../values" TF_VARS_FILE="${TF_DIR}/retry-selection.auto.tfvars.json" -COMMIT_HASH="${GITHUB_SHA}" +# name of the uploaded bundle; overridden by workflow_dispatch builds +COMMIT_HASH="${COMMIT_HASH:-$GITHUB_SHA}" ARTIFACT="wire-server-deploy-static-${COMMIT_HASH}" # Retry matrix diff --git a/offline/cd_demo.sh b/offline/cd_demo.sh index 2ce41674a..ba11964ff 100755 --- a/offline/cd_demo.sh +++ b/offline/cd_demo.sh @@ -13,7 +13,8 @@ INVENTORY_DIR="${ANSIBLE_DIR}/inventory/demo" INVENTORY_FILE="${INVENTORY_DIR}/host.yml" TF_VARS_FILE="${TF_DIR}/retry-selection.auto.tfvars.json" TEST_USER="demo" -COMMIT_HASH="${GITHUB_SHA}" +# name of the uploaded bundle; overridden by workflow_dispatch builds +COMMIT_HASH="${COMMIT_HASH:-$GITHUB_SHA}" # Retry matrix # Locations are tried in order and exhaust all server types before moving on. diff --git a/offline/cd_staging.sh b/offline/cd_staging.sh index dc344a4db..2e6d4cadc 100755 --- a/offline/cd_staging.sh +++ b/offline/cd_staging.sh @@ -6,7 +6,8 @@ CD_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" TF_DIR="${CD_DIR}/../terraform/examples/wiab-staging-hetzner" VALUES_DIR="${CD_DIR}/../values" TF_VARS_FILE="${TF_DIR}/retry-selection.auto.tfvars.json" -COMMIT_HASH="${GITHUB_SHA}" +# name of the uploaded bundle; overridden by workflow_dispatch builds +COMMIT_HASH="${COMMIT_HASH:-$GITHUB_SHA}" ARTIFACT="wire-server-deploy-static-${COMMIT_HASH}" # Retry matrix diff --git a/offline/default-build/build.sh b/offline/default-build/build.sh index 93b4d14f0..1505fd9a6 100755 --- a/offline/default-build/build.sh +++ b/offline/default-build/build.sh @@ -25,6 +25,11 @@ TASKS_DIR="${SCRIPT_DIR}/../tasks" # Processing helm charts # -------------------------- +ansible --version + +# build linux packages +"${TASKS_DIR}"/build_linux_pkgs.sh "${OUTPUT_DIR}" "${ROOT_DIR}" + # pulling the charts based on builds.json, charts to be skipped are passed as arguments HELM_CHART_EXCLUDE_LIST "${TASKS_DIR}"/proc_pull_charts.sh OUTPUT_DIR="${OUTPUT_DIR}" HELM_CHART_EXCLUDE_LIST="inbucket,wire-server-enterprise,postgresql,rust-sft,fluent-bit,fake-aws-s3" @@ -67,9 +72,6 @@ cp -r "${ROOT_DIR}"/dashboards "${OUTPUT_DIR}"/ # building admin host containers, has dependenct on the helm charts "${TASKS_DIR}"/build_adminhost_containers.sh "${OUTPUT_DIR}" --adminhost --zauth -# build linux packages -"${TASKS_DIR}"/build_linux_pkgs.sh "${OUTPUT_DIR}" "${ROOT_DIR}" - # Creating system containers tarball "${TASKS_DIR}"/proc_system_containers.sh "${OUTPUT_DIR}" diff --git a/offline/tasks/proc_pull_charts.sh b/offline/tasks/proc_pull_charts.sh index fa3c60da9..ec9684aa6 100755 --- a/offline/tasks/proc_pull_charts.sh +++ b/offline/tasks/proc_pull_charts.sh @@ -1,7 +1,11 @@ #!/usr/bin/env bash +# shellcheck disable=SC2190 set -euo pipefail OUTPUT_DIR="" +# build.json to source chart versions from; override with the WIRE_BUILD= +# argument or the WIRE_BUILD environment variable +WIRE_BUILD="${WIRE_BUILD:-https://raw.githubusercontent.com/wireapp/wire-builds/refs/heads/2026-q4-from-rm/build.json}" # Default exclude lists HELM_CHART_EXCLUDE_LIST="inbucket,wire-server-enterprise,demo-smtp" @@ -15,6 +19,9 @@ do HELM_CHART_EXCLUDE_LIST=*) HELM_CHART_EXCLUDE_LIST="${arg#*=}" ;; + WIRE_BUILD=*) + WIRE_BUILD="${arg#*=}" + ;; *) echo "Unknown argument: $arg" >&2 exit 1 @@ -24,7 +31,7 @@ done # Check if OUTPUT_DIR is set if [[ -z "$OUTPUT_DIR" ]]; then - echo "usage: $0 OUTPUT_DIR=\"output-dir\" [HELM_CHART_EXCLUDE_LIST=\"chart1,chart2,...\"]" >&2 + echo "usage: $0 OUTPUT_DIR=\"output-dir\" [HELM_CHART_EXCLUDE_LIST=\"chart1,chart2,...\"] [WIRE_BUILD=\"build.json-url\"]" >&2 exit 1 fi @@ -46,9 +53,27 @@ wire_build_chart_release () { ' "${OUTPUT_DIR}/build.json" } +# Log in to an OCI registry once, if credentials are available +# (OCI_REGISTRY_USERNAME / OCI_REGISTRY_PASSWORD). Public charts are pulled +# anonymously when no credentials are set. +declare -A registry_logged_in +oci_registry_login() { + local registry="$1" + if [[ -n "${registry_logged_in[$registry]}" || -z "${OCI_REGISTRY_USERNAME:-}" ]]; then + return 0 + fi + echo "Logging in to OCI registry $registry as $OCI_REGISTRY_USERNAME" + helm registry login "$registry" --username "$OCI_REGISTRY_USERNAME" --password-stdin <<< "${OCI_REGISTRY_PASSWORD:?OCI_REGISTRY_PASSWORD must be set}" + registry_logged_in[$registry]=1 +} + # pull_charts() accepts charts in format # -# on stdin +# on stdin. +# For OCI charts, is the full chart reference +# (e.g. oci://quay.io/wire/charts/dev/wire-server), whose last path segment +# may differ from (e.g. webapp -> wire-webapp). +# Every chart is extracted to ${OUTPUT_DIR}/charts/. pull_charts() { echo "Pulling charts into ${OUTPUT_DIR}/charts ..." mkdir -p "${OUTPUT_DIR}"/charts @@ -70,20 +95,34 @@ pull_charts() { repo=${parts[1]} version=${parts[2]} - # we add and update the repo only the first time we see it to speed up the process - repo_short_name=${repos[$repo]} - if [ "$repo_short_name" == "" ]; then - n=${#repos[@]} - repo_short_name="repo_$((n+1))" - repos[$repo]=$repo_short_name - helm repo add "$repo_short_name" "$repo" - helm repo update "$repo_short_name" + if [[ "$repo" == oci://* ]]; then + # OCI charts are pulled directly by reference, no helm repo add needed + registry=${repo#oci://} + oci_registry_login "${registry%%/*}" + chart_ref="$repo" + else + # For traditional repos, add and update only on first encounter + repo_short_name=${repos[$repo]} + if [ "$repo_short_name" == "" ]; then + n=${#repos[@]} + repo_short_name="repo_$((n+1))" + repos[$repo]=$repo_short_name + helm repo add "$repo_short_name" "$repo" + helm repo update "$repo_short_name" + fi + chart_ref="$repo_short_name/$name" fi - (cd "${OUTPUT_DIR}"/charts; helm pull --version "$version" --untar "$repo_short_name/$name") + + # untar into a scratch dir, then move to charts/ so the layout does + # not depend on the chart's own name + untar_dir=$(mktemp -d) + helm pull --version "$version" --untar --untardir "$untar_dir" "$chart_ref" + rm -rf "${OUTPUT_DIR:?}/charts/${name}" + mv "$untar_dir"/* "${OUTPUT_DIR}/charts/${name}" + rm -rf "$untar_dir" done echo "Pulling charts done." } -wire_build="https://raw.githubusercontent.com/wireapp/wire-builds/refs/heads/pinned-offline-5.34.0/build.json" -wire_build_chart_release "$wire_build" | pull_charts +wire_build_chart_release "$WIRE_BUILD" | pull_charts