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

feat: Add istio and preliminary ci #3

Merged
merged 17 commits into from
Oct 27, 2023
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
3 changes: 3 additions & 0 deletions .github/bundle-filters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
uds-core:
# - 'capabilities/**/*'
- 'uds-*.y*ml'
5 changes: 5 additions & 0 deletions .github/filters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

istio:
- 'capabilities/istio/**/*'
neuvector:
- 'capabilities/neuvector/**/*'
116 changes: 116 additions & 0 deletions .github/workflows/build-and-test-bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Build and Test uds core bundles on k3d


on:
workflow_dispatch:
inputs:
capability:
type: string
default: ""
bundle:
type: string
default: ""
platform:
type: string
default: 'ubuntu-latest'
workflow_call:
inputs:
capability:
type: string
default: ""
bundle:
type: string
default: ""
platform:
type: string
default: 'ubuntu-latest'

permissions:
id-token: write
contents: read

jobs:
setup:
outputs:
bundle-path: ${{ steps.bundle-default.outputs.path }}
capability-path: ${{ steps.capability-default.outputs.path }}
runs-on: ubuntu-latest
steps:
- name: Set Bundle Path
id: bundle-default
run: |
PATH="."
[ ${{ inputs.bundle }} != 'uds-core' ] && PATH="${{ inputs.bundle }}"
echo "path=$PATH" >> $GITHUB_OUTPUT
if: ${{ inputs.bundle }} != ''
- name: Set Capability Path
id: capability-default
run: |
echo "path=capabilities/${{ inputs.capability }}" >> $GITHUB_OUTPUT
if: ${{ inputs.capability }} != ''

build-and-test:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

# - name: Login to Registry1
# uses: docker/login-action@v3
# with:
# registry: registry1.dso.mil
# username: ${{ secrets.REGISTRY1_USERNAME }}
# password: ${{ secrets.REGISTRY1_PASSWORD }}

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: dummy
password: ${{ secrets.GITHUB_TOKEN }}

- name: Install Zarf
uses: defenseunicorns/setup-zarf@main
with:
# renovate: datasource=github-tags depName=defenseunicorns/zarf versioning=semver
version: v0.30.1
download-init-package: true
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: dummy
password: ${{ secrets.GITHUB_TOKEN }}

- name: Use Node.js latest
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: latest

- name: Install k3d
run: |
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.6.0 bash

- name: Build Bundle
shell: bash
run: zarf package create --confirm
working-directory: "${{ needs.setup.outputs.bundle-path }}/.github/zarf-runner/bob-the-builder"
if: ${{ inputs.bundle }} != ''

- name: Deploy Bundle
shell: bash
run: zarf package create --confirm
working-directory: "${{ needs.setup.outputs.bundle-path }}/.github/zarf-runner/deploy"
if: ${{ inputs.bundle }} != ''
env:
TENANT_GATEWAY_TLS_CERT: ${{ secrets.TENANT_GATEWAY_TLS_CERT }}
TENANT_GATEWAY_TLS_KEY: ${{ secrets.TENANT_GATEWAY_TLS_KEY}}
ADMIN_GATEWAY_TLS_CERT: ${{ secrets.ADMIN_GATEWAY_TLS_CERT }}
ADMIN_GATEWAY_TLS_KEY: ${{ secrets.ADMIN_GATEWAY_TLS_KEY}}

- name: Test Bundle
shell: bash
run: zarf package create --confirm
working-directory: "${{ needs.setup.outputs.bundle-path }}/.github/zarf-runner/test"
if: ${{ inputs.bundle }} != ''
118 changes: 118 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Build and Test uds core Capabilities on k3d


on:
workflow_dispatch:
inputs:
capability:
type: string
default: ""
bundle:
type: string
default: ""
platform:
type: string
default: 'ubuntu-latest'
workflow_call:
inputs:
capability:
type: string
default: ""
bundle:
type: string
default: ""
platform:
type: string
default: 'ubuntu-latest'

permissions:
id-token: write
contents: read

jobs:
setup:
outputs:
bundle-path: ${{ steps.bundle-default.outputs.path }}
capability-path: ${{ steps.capability-default.outputs.path }}
runs-on: ubuntu-latest
steps:
- name: Set Bundle Path
id: bundle-default
run: |
PATH="."
[ ${{ inputs.bundle }} != 'uds-core' ] && PATH="${{ inputs.bundle }}"
echo "path=$PATH" >> $GITHUB_OUTPUT
if: ${{ inputs.bundle }} != ''
- name: Set Capability Path
id: capability-default
run: |
echo "path=capabilities/${{ inputs.capability }}" >> $GITHUB_OUTPUT
if: ${{ inputs.capability }} != ''

build-and-test:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

# - name: Login to Registry1
# uses: docker/login-action@v3
# with:
# registry: registry1.dso.mil
# username: ${{ secrets.REGISTRY1_USERNAME }}
# password: ${{ secrets.REGISTRY1_PASSWORD }}

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: dummy
password: ${{ secrets.GITHUB_TOKEN }}

- name: Install Zarf
uses: defenseunicorns/setup-zarf@main
with:
# renovate: datasource=github-tags depName=defenseunicorns/zarf versioning=semver
version: v0.30.1
download-init-package: true
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: dummy
password: ${{ secrets.GITHUB_TOKEN }}

- name: Use Node.js latest
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: latest

- name: Install k3d
run: |
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.6.0 bash

- name: Build Capability
shell: bash
run: zarf package create --confirm
working-directory: "${{ needs.setup.outputs.capability-path }}/.github/zarf-runner/bob-the-builder"
if: ${{ inputs.capability }} != ''

- name: Deploy Capability
shell: bash
run: zarf package create --confirm
working-directory: "${{ needs.setup.outputs.capability-path }}/.github/zarf-runner/deploy"
zachariahmiller marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ inputs.capability }} != ''
env:
TENANT_GATEWAY_TLS_CERT: ${{ secrets.TENANT_GATEWAY_TLS_CERT }}
TENANT_GATEWAY_TLS_KEY: ${{ secrets.TENANT_GATEWAY_TLS_KEY}}
ADMIN_GATEWAY_TLS_CERT: ${{ secrets.ADMIN_GATEWAY_TLS_CERT }}
ADMIN_GATEWAY_TLS_KEY: ${{ secrets.ADMIN_GATEWAY_TLS_KEY}}


- name: Test Capability
shell: bash
run: zarf package create --confirm
working-directory: "${{ needs.setup.outputs.capability-path }}/.github/zarf-runner/test"
if: ${{ inputs.capability }} != ''

68 changes: 68 additions & 0 deletions .github/workflows/ci-on-pull-request-k3d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
on:
pull_request:
branches:
- main
paths-ignore:
- ".gitignore"
- "LICENSE"
- "**/*.md"
- "**/*.json"
- "**/*.png"
- "**/*.svg"

permissions:
id-token: write
contents: read
pull-requests: read

defaults:
run:
# We need -e -o pipefail for consistency with GitHub Actions' default behavior
shell: bash -e -o pipefail {0}


jobs:
check-paths:
runs-on: ubuntu-latest
outputs:
capabilities: ${{ steps.path-filter.outputs.changes }}
bundles: ${{ steps.bundle-path-filter.outputs.changes }}
steps:
- name: Checkout the code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Check capability paths
id: path-filter
uses: dorny/paths-filter@v2
with:
filters: .github/filters.yaml
- name: Debug output
run: echo "${{ steps.path-filter.outputs.changes }}"

- name: Check bundle paths
id: bundle-path-filter
uses: dorny/paths-filter@v2
with:
filters: .github/bundle-filters.yaml
- name: Debug output
run: echo "${{ steps.bundle-path-filter.outputs.changes }}"

build-and-test-capabilities:
needs: check-paths
strategy:
matrix:
capability: ${{ fromJSON(needs.check-paths.outputs.capabilities) }}
uses: ./.github/workflows/build-and-test.yaml
with:
capability: ${{ matrix.capability }}
secrets: inherit
if: ${{ needs.check-paths.outputs.capabilities }} != "[]"

# build-and-test-bundle:
# needs: [check-paths, build-and-test-capabilities]
# strategy:
# matrix:
# bundle: ${{ fromJSON(needs.check-paths.outputs.bundles) }}
# uses: ./.github/workflows/build-and-test-bundle.yaml
# secrets: inherit
# if: ${{ needs.check-paths.outputs.bundles }} != "[]"
34 changes: 34 additions & 0 deletions .github/workflows/publish-capability.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Capability Package

# This is a placeholder for now
on:
workflow_call:
inputs:
platform:
type: string
default: 'ubuntu-latest'

permissions:
contents: read
packages: write

jobs:
publish-package:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: dummy
password: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Zarf Package
run: zarf package create . --confirm
working-directory: ".github/zarf-runner/release"
timeout-minutes: 60


28 changes: 28 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: build-and-publish

on:
push:
tags: [ "*" ]
workflow_dispatch:

permissions:
id-token: write
contents: read
packages: write

defaults:
run:
# We need -e -o pipefail for consistency with GitHub Actions' default behavior
shell: bash -e -o pipefail {0}


jobs:
publish-package:
strategy:
matrix:
os: [ubuntu-latest] #windows-latest macos-latest
uses: ./.github/workflows/publish-capability.yaml
with:
platform: ${{ matrix.os }}
secrets: inherit

4 changes: 4 additions & 0 deletions .github/zarf-runner/bob-the-builder/zarf-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package:
create:
set:
uds_cli_version: "v0.0.6-alpha"
Loading