Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test linux deployments #2322

Merged
merged 8 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/promote-downstreams.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
${{ matrix.image.repo }}:${{ needs.parse_version.outputs.version }}

promote_artifactory:
name: Promote ${{ matrix.package_name }}-${{ matrix.arch.rpm }}.${{ matrix.nfpm_packager }}
name: Promote ${{ matrix.package_name }}-${{ matrix.arch.rpm }}.${{ matrix.packager }}
needs: parse_version
strategy:
fail-fast: true
Expand All @@ -96,7 +96,7 @@ jobs:
rpm: aarch64
- deb: armv7
rpm: armv7
nfpm_packager:
packager:
- rpm
- deb
runs-on: ubuntu-latest
Expand All @@ -112,7 +112,7 @@ jobs:
JF_ENV_1: ${{ secrets.ZITI_ARTIFACTORY_CLI_CONFIG_PACKAGE_UPLOAD }}

- name: Copy RPM from test repo to stable repo with jFrog CLI
if: matrix.nfpm_packager == 'rpm'
if: matrix.packager == 'rpm'
shell: bash
run: >
jf rt copy
Expand All @@ -122,7 +122,7 @@ jobs:
${{ env.ZITI_RPM_PROD_REPO }}/redhat/${{ matrix.arch.rpm }}/

- name: Copy DEB from test repo to stable repo with jFrog CLI
if: matrix.nfpm_packager == 'deb'
if: matrix.packager == 'deb'
shell: bash
run: >
jf rt copy
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/publish-linux-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
publish-linux-packages:
name: ${{ matrix.package_name }} ${{ matrix.arch.rpm }} ${{ matrix.nfpm_packager }}
name: ${{ matrix.package_name }} ${{ matrix.arch.gox }} ${{ matrix.packager }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -31,7 +31,7 @@ jobs:
gox: arm
deb: armv7
rpm: armv7
nfpm_packager:
packager:
- rpm
- deb
# - archlinux # (pacman)
Expand All @@ -40,11 +40,12 @@ jobs:
ZITI_VERSION: ${{ inputs.ziti-version || github.event.inputs.ziti-version }}
ZITI_MAINTAINER: "OpenZiti Maintainers <[email protected]>"
ZITI_HOMEPAGE: "https://openziti.io"
ZITI_VENDOR: "NetFoundry"
ZITI_VENDOR: "NetFoundry Inc."
GOARCH: ${{ matrix.arch.goreleaser }}
MINIMUM_SYSTEMD_VERSION: 232
ZITI_DEB_TEST_REPO: ${{ vars.ZITI_DEB_TEST_REPO || 'zitipax-openziti-deb-test' }}
ZITI_RPM_TEST_REPO: ${{ vars.ZITI_RPM_TEST_REPO || 'zitipax-openziti-rpm-test' }}
NFPM_VERSION: "2.38.0"
steps:
- name: Checkout Workspace
uses: actions/checkout@v4
Expand All @@ -63,11 +64,11 @@ jobs:

- name: Build Package
id: nfpm
uses: burningalchemist/action-gh-nfpm@v1
uses: burningalchemist/action-gh-nfpm@eeac96f42da23d091eec0d0088bf05cac0ceb9f3
# uses: netfoundry/action-gh-nfpm@main
with:
nfpm_version: "2.32.0"
packager: ${{ matrix.nfpm_packager }}
nfpm_version: ${{ env.NFPM_VERSION }}
packager: ${{ matrix.packager }}
config: dist/dist-packages/linux/nfpm-${{ matrix.package_name }}.yaml
target: release/

Expand All @@ -81,8 +82,8 @@ jobs:
- name: upload package artifact to build summary page
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.package_name }}-${{ matrix.arch.goreleaser }}-${{ matrix.nfpm_packager }}
path: ./release/${{ matrix.package_name }}*.${{ matrix.nfpm_packager }}
name: ${{ matrix.package_name }}-${{ matrix.arch.gox }}-${{ matrix.packager }}
path: ./release/${{ matrix.package_name }}*.${{ matrix.packager }}
if-no-files-found: error

- name: Configure jFrog CLI
Expand All @@ -91,7 +92,7 @@ jobs:
JF_ENV_1: ${{ secrets.ZITI_ARTIFACTORY_CLI_CONFIG_PACKAGE_UPLOAD }}

- name: Upload RPM to Artifactory testing repo
if: matrix.nfpm_packager == 'rpm'
if: matrix.packager == 'rpm'
shell: bash
run: >
jf rt upload
Expand All @@ -101,7 +102,7 @@ jobs:
--flat=true

- name: Upload DEB to Artifactory testing repo
if: matrix.nfpm_packager == 'deb'
if: matrix.packager == 'deb'
shell: bash
run: >
jf rt upload
Expand Down
236 changes: 236 additions & 0 deletions .github/workflows/test-deployments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
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-latest
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@v4

- name: Install Go
id: setup-go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod

- 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 <[email protected]>"
ZITI_HOMEPAGE: "https://openziti.io"
ZITI_VENDOR: "NetFoundry Inc."
GOARCH: ${{ matrix.arch.goreleaser }}
MINIMUM_SYSTEMD_VERSION: 232

- name: Upload Package to Build Summary
uses: actions/upload-artifact@v4
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-latest
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@v4
with:
pattern: "*-${{ matrix.arch.gox }}-${{ matrix.distro.type }}"
merge-multiple: true
path: release/

- name: Install Packages
shell: bash
run: |
set -x
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 -x
/opt/openziti/etc/controller/bootstrap.bash <<CTRL
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"
CTRL

/opt/openziti/etc/router/bootstrap.bash <<ROUTER
ZITI_CTRL_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS}
ZITI_CTRL_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT}
ZITI_ROUTER_ADVERTISED_ADDRESS=${ZITI_ROUTER_ADVERTISED_ADDRESS}
ZITI_ROUTER_PORT=${ZITI_ROUTER_PORT}
ZITI_BOOTSTRAP_ENROLLMENT=false
ZITI_ARGS="--verbose"
ROUTER

test-linux-services:
name: Test Debian Linux Services
runs-on: ubuntu-latest
steps:
- name: Shallow checkout
uses: actions/checkout@v4

- name: Install Go
id: setup-go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod

- name: Install nfpm
shell: bash
run: |
echo ~/.local/bin >> $GITHUB_PATH
mkdir -p ~/.local/bin
wget -qO- https://github.com/goreleaser/nfpm/releases/download/v${{ env.NFPM_VERSION }}/nfpm_${{ env.NFPM_VERSION }}_Linux_x86_64.tar.gz | tar --directory ~/.local/bin -xz nfpm
nfpm --version

- name: Bootstrap & Run
shell: bash
env:
I_AM_ROBOT: 1 # let CI runner skip destructive script warning
run: ./dist/dist-packages/linux/linux.test.bash

- name: Debug Info
if: always()
shell: bash
run: |
set -x
set +e
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

docker-deployments:
name: Test Docker Deployments
runs-on: ubuntu-latest
env:
ZIGGY_UID: 1001 # let container EUID run-as GHA "runner" user to share cache, etc.
steps:
- name: Shallow checkout
uses: actions/checkout@v4

- name: Install Go
id: setup-go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod

- name: Run the Compose Test Script
shell: bash
run: dist/docker-images/compose.test.bash
env:
ZITI_GO_VERSION: ${{ steps.setup-go.outputs.go-version }}
36 changes: 0 additions & 36 deletions .github/workflows/test-docker-deployments.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/test-quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ jobs:
id runner
ls -lAn ${GOCACHE:-${HOME}/.cache/go-build}/ ${GOPATH:-${HOME}/go}/pkg/mod/
docker compose --profile test logs
exit 0
Loading
Loading