Skip to content

Commit

Permalink
Add E2E test workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaus67 committed Nov 3, 2023
1 parent ed15d99 commit 0572a78
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: E2E

on:
# TODO(dhaus): Temporary to test the workflow.
pull_request:
push:
branches:
- main
paths-ignore:
- 'dist/**'
schedule:
- cron: '0 5 * * 0'

jobs:
e2e:
if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork
name: E2E
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Checkout stackrox repo
uses: actions/checkout@v4
with:
repository: stackrox/stackrox
path: stackrox

- name: Install kubectl
run: sudo snap install kubectl --classic

- name: Setup infractl
uses: stackrox/actions/infra/install-infractl@main

- name: Create infra GKE cluster
uses: stackrox/actions/infra/[email protected]
with:
token: ${{ secrets.INFRA_TOKEN }}
flavor: gke-default
name: central-login-${{ github.run_id }}
lifespan: 15m
wait: "true"

- name: Deploy Stackrox to GKE
env:
CLUSTER_NAME: central-login-${{ github.run_id }}
ARTIFACTS_DIR: ${{ runner.temp }}/gke-artifacts
run: |
# Fetch the artifacts for the GKE cluster.
infractl artifacts --download-dir=${ARTIFACTS_DIR} ${CLUSTER_NAME}
# Setup context for GKE cluster.
echo "KUBECONFIG=${ARTIFACTS_DIR}/kubeconfig" >> $GITHUB_OUTPUT
# Deploy Central via deploy scripts.
cd stackrox
./deploy/central.sh
echo "ROX_PASSWORD=$(cat deploy/k8s/central-deploy/password)" >> $GITHUB_OUTPUT
echo "ROX_ENDPOINT=$()" >> $GITHUB_OUTPUT
- name: Wait for API
env:
USE_MIDSTREAM_IMAGES: false
run: |
cd stackrox
source "tests/e2e/lib.sh"
wait_for_api
- name: Configure M2M configuration
run: |
curl https://localhost:8000/v1/auth/m2m -k -d '{"{"config": {"type": "GITHUB_ACTIONS", "tokenExpirationDuration": "5m", "mappings":[{"key":"sub","valueExpression":"repo:stackrox/central-login.*", "role":"Analyst"}]}}"}'
- name: Run Central-login action
uses: ./
with:
endpoint: https://localhost:8000
skip-tls-verify: true

- name: Run roxctl central whoami
uses: quay.io/stackrox-io/roxctl:latest
with:
args: central whoami

0 comments on commit 0572a78

Please sign in to comment.