refine linux upgrade #2690
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Deployments | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| # cancel older, redundant runs of same workflow on same branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
| cancel-in-progress: true | |
| env: | |
| NFPM_VERSION: "2.38.0" | |
| jobs: | |
| build-linux-packages: | |
| name: Build ${{ matrix.package_name }} ${{ matrix.arch.gox }} ${{ matrix.packager }} | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| package_name: | |
| - openziti | |
| - openziti-controller | |
| - openziti-router | |
| arch: | |
| - goreleaser: amd64 | |
| gox: amd64 | |
| deb: amd64 | |
| rpm: x86_64 | |
| packager: | |
| - rpm | |
| - deb | |
| steps: | |
| - name: Shallow checkout | |
| uses: actions/checkout@v6 | |
| - name: Install Go | |
| id: setup-go | |
| uses: ./.github/actions/setup-go | |
| - name: Build ziti executable | |
| shell: bash | |
| run: | | |
| mkdir -pv ${GITHUB_WORKSPACE}/release/ | |
| go build -o ${GITHUB_WORKSPACE}/release/ ${GITHUB_WORKSPACE}/... | |
| - name: Build Package | |
| id: nfpm | |
| uses: burningalchemist/action-gh-nfpm@eeac96f42da23d091eec0d0088bf05cac0ceb9f3 | |
| with: | |
| nfpm_version: ${{ env.NFPM_VERSION }} | |
| packager: ${{ matrix.packager }} | |
| config: dist/dist-packages/linux/nfpm-${{ matrix.package_name }}.yaml | |
| target: release/ | |
| env: | |
| ZITI_VERSION: 0.0.0 | |
| ZITI_MAINTAINER: "OpenZiti Maintainers <developers@openziti.org>" | |
| ZITI_HOMEPAGE: "https://openziti.io" | |
| ZITI_VENDOR: "NetFoundry Inc." | |
| TARGETARCH: ${{ matrix.arch.goreleaser }} | |
| NFPM_ARCH: ${{ matrix.packager == 'deb' && 'all' || 'noarch' }} | |
| MINIMUM_SYSTEMD_VERSION: 232 | |
| - name: Upload Package to Build Summary | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.package_name }}-${{ matrix.arch.gox }}-${{ matrix.packager }} | |
| path: ./release/${{ matrix.package_name }}*.${{ matrix.packager }} | |
| if-no-files-found: error | |
| dry-run-linux-packages: | |
| needs: build-linux-packages | |
| name: Dry Run ${{ format('{0}:{1}', matrix.distro.name, matrix.distro.version) }} ${{ matrix.arch.gox }} | |
| runs-on: ubuntu-24.04 | |
| env: | |
| ZITI_PWD: ziggypw | |
| ZITI_CTRL_ADVERTISED_ADDRESS: linux-controller.127.21.71.0.sslip.io | |
| ZITI_CTRL_ADVERTISED_PORT: 12800 | |
| ZITI_ROUTER_ADVERTISED_ADDRESS: linux-router.127.21.71.0.sslip.io | |
| ZITI_ROUTER_PORT: 30222 | |
| ZITI_ROUTER_NAME: linux-router | |
| # iterate over an assortment of popular distribution images | |
| container: | |
| image: docker.io/library/${{ format('{0}:{1}', matrix.distro.name, matrix.distro.version) }} | |
| options: --user 0:0 | |
| strategy: | |
| matrix: | |
| distro: | |
| - name: ubuntu | |
| version: "24.04" | |
| org: | |
| type: deb | |
| - name: ubuntu | |
| version: "22.04" | |
| type: deb | |
| - name: ubuntu | |
| version: "20.04" | |
| type: deb | |
| - name: fedora | |
| version: "39" | |
| type: rpm | |
| - name: fedora | |
| version: "38" | |
| type: rpm | |
| - name: fedora | |
| version: "37" | |
| type: rpm | |
| - name: fedora | |
| version: "36" | |
| type: rpm | |
| - name: fedora | |
| version: "35" | |
| type: rpm | |
| - name: rockylinux | |
| version: "9" | |
| type: rpm | |
| arch: | |
| - goreleaser: amd64 | |
| gox: amd64 | |
| deb: amd64 | |
| rpm: x86_64 | |
| steps: | |
| - name: Download Linux Release Artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: "*-${{ matrix.arch.gox }}-${{ matrix.distro.type }}" | |
| merge-multiple: true | |
| path: release/ | |
| - name: Install Packages | |
| shell: bash | |
| run: | | |
| set -o pipefail | |
| set -o xtrace | |
| ls -lR ./release/ | |
| case "${{ matrix.distro.type }}" in | |
| rpm) | |
| dnf makecache --refresh | |
| dnf install -y systemd # install as impotent dep (not PID 1) | |
| dnf install -y ./release/openziti-${ZITI_VERSION}*.${{ matrix.distro.type }} # install CLI | |
| dnf install -y ./release/openziti-*-${ZITI_VERSION}*.${{ matrix.distro.type }} # install controller, router | |
| ;; | |
| deb) | |
| apt-get update | |
| apt-get install -y systemd # install as impotent dep (not PID 1) | |
| dpkg --install ./release/openziti_*.${{ matrix.distro.type }} # install CLI | |
| dpkg --install ./release/openziti-*.${{ matrix.distro.type }} # install controller, router | |
| ;; | |
| esac | |
| - name: Bootstrapping - Dry Run | |
| shell: bash | |
| env: | |
| DEBUG: 1 | |
| run: | | |
| set -o pipefail | |
| set -o xtrace | |
| CTRL_ANSWERS="$(mktemp)" | |
| cat > "${CTRL_ANSWERS}" <<EOF | |
| ZITI_CTRL_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS} | |
| ZITI_CTRL_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT} | |
| ZITI_USER=admin | |
| ZITI_PWD=${ZITI_PWD} | |
| ZITI_ARGS="--verbose" | |
| EOF | |
| /opt/openziti/etc/controller/bootstrap.bash "${CTRL_ANSWERS}" </dev/null | |
| RTR_ANSWERS="$(mktemp)" | |
| cat > "${RTR_ANSWERS}" <<EOF | |
| ZITI_ROUTER_ADVERTISED_ADDRESS=${ZITI_ROUTER_ADVERTISED_ADDRESS} | |
| ZITI_ROUTER_PORT=${ZITI_ROUTER_PORT} | |
| ZITI_BOOTSTRAP_ENROLLMENT=false | |
| ZITI_ARGS="--verbose" | |
| EOF | |
| /opt/openziti/etc/router/bootstrap.bash "${RTR_ANSWERS}" </dev/null | |
| linux-install-test: | |
| name: Test Linux Fresh Install | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Shallow checkout | |
| uses: actions/checkout@v6 | |
| - name: Install Go | |
| id: setup-go | |
| uses: ./.github/actions/setup-go | |
| - name: Install nfpm | |
| shell: bash | |
| run: | | |
| set -o pipefail | |
| set -o xtrace | |
| echo ~/.local/bin >> $GITHUB_PATH | |
| mkdir -p ~/.local/bin | |
| wget -qO- https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${NFPM_VERSION}_Linux_x86_64.tar.gz | tar --directory ~/.local/bin -xz nfpm | |
| nfpm --version | |
| - name: Install nspawn dependencies | |
| shell: bash | |
| run: sudo apt-get update && sudo apt-get install -y mmdebstrap systemd-container | |
| - name: Cache nspawn OS rootfs | |
| uses: actions/cache@v4 | |
| with: | |
| path: /var/cache/openziti-test | |
| key: nspawn-base-${{ hashFiles('/etc/os-release') }} | |
| - name: Run fresh install test | |
| shell: bash | |
| run: ./dist/dist-packages/linux/dangerous.install.linux.test.bash | |
| - name: Debug Info | |
| if: always() | |
| shell: bash | |
| run: | | |
| set -o xtrace | |
| set +o errexit | |
| sudo ss -lntp | grep -E ":(${ZITI_CTRL_ADVERTISED_PORT}|${ZITI_ROUTER_PORT})" | |
| sudo journalctl --no-pager -o cat -u ziti-controller.service | |
| sudo journalctl --no-pager -o cat -u ziti-router.service | |
| cat /opt/openziti/etc/**/*.env /tmp/${ZITI_ROUTER_NAME}.jwt | |
| exit 0 | |
| linux-upgrade-test: | |
| name: Test Linux v1-to-v2 Upgrade | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Shallow checkout | |
| uses: actions/checkout@v6 | |
| - name: Install Go | |
| id: setup-go | |
| uses: ./.github/actions/setup-go | |
| - name: Install nfpm | |
| shell: bash | |
| run: | | |
| set -o pipefail | |
| set -o xtrace | |
| echo ~/.local/bin >> $GITHUB_PATH | |
| mkdir -p ~/.local/bin | |
| wget -qO- https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${NFPM_VERSION}_Linux_x86_64.tar.gz | tar --directory ~/.local/bin -xz nfpm | |
| nfpm --version | |
| - name: Resolve latest stable v1 release | |
| id: v1-version | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| shell: bash | |
| run: | | |
| V1_VERSION=$( | |
| gh api --method GET 'repos/openziti/ziti/releases?per_page=100' \ | |
| --jq '[.[] | select(.prerelease == false and .draft == false) | .tag_name | select(startswith("v1."))] | map(ltrimstr("v")) | sort_by(split(".") | map(tonumber)) | last' | |
| ) | |
| echo "V1_VERSION=${V1_VERSION}" | tee -a "$GITHUB_OUTPUT" | |
| - name: Run v1-to-v2 upgrade test | |
| shell: bash | |
| run: | | |
| ./dist/dist-packages/linux/dangerous.upgrade.linux.test.bash \ | |
| --from-version "${{ steps.v1-version.outputs.V1_VERSION }}" | |
| - name: Dump journal on failure | |
| if: failure() | |
| shell: bash | |
| run: | | |
| set -o xtrace | |
| set +o errexit | |
| journalctl -u ziti-controller --no-pager -n 200 | |
| journalctl -u ziti-router --no-pager -n 200 | |
| exit 0 | |
| docker-deployments: | |
| name: Test Docker Deployments | |
| runs-on: ubuntu-24.04 | |
| env: | |
| ZIGGY_UID: 1001 # let container EUID run-as GHA "runner" user to share cache, etc. | |
| steps: | |
| - name: Shallow checkout | |
| uses: actions/checkout@v6 | |
| - name: Install Go | |
| id: setup-go | |
| uses: ./.github/actions/setup-go | |
| - name: Run the Docker Test Script | |
| shell: bash | |
| run: dist/docker-images/dangerous.docker.test.bash | |
| env: | |
| ZITI_GO_VERSION: ${{ steps.setup-go.outputs.go-version }} | |
| - name: Debug Info | |
| if: always() | |
| shell: bash | |
| run: | | |
| set -o xtrace | |
| set +o errexit | |
| dist/docker-images/dangerous.docker.test.bash ps --all | |
| for svc in ziti-controller1 ziti-controller2 ziti-controller3 ziti-router1 ziti-router2 ziti-router3; do | |
| echo "=== ${svc} ===" | |
| dist/docker-images/dangerous.docker.test.bash logs "${svc}" 2>/dev/null | tail -80 | |
| done | |
| exit 0 | |
| kubernetes-deployments: | |
| name: Test Kubernetes Deployments | |
| runs-on: ubuntu-24.04 | |
| env: | |
| ZITI_NAMESPACE: zititest | |
| steps: | |
| - name: Shallow checkout | |
| uses: actions/checkout@v6 | |
| - name: Install Go | |
| id: setup-go | |
| uses: ./.github/actions/setup-go | |
| - name: Install minikube | |
| uses: medyagh/setup-minikube@v0.0.21 | |
| with: | |
| start: false | |
| - name: Run the Kubernetes Test Script | |
| shell: bash | |
| run: ./dist/docker-images/dangerous.k8s.test.bash --cpus=2 # GitHub runners have 4 vCPUs |