Skip to content

[WIP] Add e2e github action #10

[WIP] Add e2e github action

[WIP] Add e2e github action #10

Workflow file for this run

# Copyright 2024 NVIDIA CORPORATION

Check failure on line 1 in .github/workflows/e2e.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/e2e.yaml

Invalid workflow file

`worklow_run` is not a valid event name
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: e2e
on:
worklow_run:
workflows: ["image"]
types:
- completed
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout code
- name: Calculate test env vars
id: vars
run: |
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Install YQ
run: |
sudo add-apt-repository ppa:rmescandon/yq -y
sudo apt-get update
sudo apt-get install yq -y
yq --version
- name: Get private key
run: |
cat << EOF > ./key.pem
${{ secrets.AWS_SSH_KEY }}
EOF
chmod00 ./key.pem
- name: Install and setup Holodeck
env:
HOLODECK_VERSION: v0.1.1
HOLODECK_INSTANCE: gh-action-${GITHUB_SHA:0:8}
SSH_KEY: ${{ github.workspace }}/key.pem
run: |
curl -sL https://github.com/NVIDIA/holodeck/releases/download/${HOLODECK_VERSION}/holodeck-linux-amd64 -o /usr/local/bin/holodeck
chmod +x /usr/local/bin/holodeck
yq -i --arg hi "${{ env.HOLODECK_INSTANCE }}" '.metadata.name = "$hi"' holodeck.yaml
yq -i --arg key "${{ env.SSH_KEY }}" '.spec.auth.privateKey = "$key"' holodeck.yaml
- name: Create test environment
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
holodeck create -f holodeck.yaml -p -c ${{ github.workspace }}/${COMMIT_SHORT_SHA} -k ./kubeconfig
- name: Run tests
env:
KUBECONFIG: ${{ github.workspace }}/kubeconfig
E2E_IMAGE_REPO: ghcr.io/nvidia/k8s-device-plugin
E2E_IMAGE_TAG: ${COMMIT_SHORT_SHA}-ubuntu20.04
run: |
echo "Running e2e-tests"
make -f tests/e2e/Makefile e2e-test
- name: Cleanup
run: |
holodeck delete -f holodeck.yaml -c ${{ github.workspace }}/${COMMIT_SHORT_SHA}