-
Notifications
You must be signed in to change notification settings - Fork 59
Fng infra install fix v2 #249
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
Open
FNGarvin
wants to merge
7
commits into
runpod:main
Choose a base branch
from
FNGarvin:fng-infra-install-fix-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
06e3c5d
feat: portable, root-free installer refactor (dependency-free)
FNGarvin 6a90c8c
Migrate integration tests to Go e2e suite with parameterization and s…
FNGarvin 581c642
implement Sourcery suggestions
FNGarvin 47c615a
refactor: address review feedback for installer and E2E tests
FNGarvin 5784cc8
Refine installer for hermeticity and improve CI test coverage
FNGarvin 164d0dd
removing functionality
FNGarvin 82a331e
Merge branch 'runpod:main' into fng-infra-install-fix-v2
FNGarvin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| name: Integration Test Matrix | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| workflow_dispatch: | ||
| inputs: | ||
| pod_image: | ||
| description: 'Image to test for Pod lifecycle' | ||
| required: false | ||
| default: 'docker.io/library/alpine' | ||
| serverless_image: | ||
| description: 'Image to test for Serverless lifecycle' | ||
| required: false | ||
| default: 'alpine:latest' | ||
|
|
||
| concurrency: | ||
| group: integration-tests-${{ github.ref_name }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test-matrix: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| user_mode: [root, non-root] | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.25.7' | ||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update && sudo apt-get install -y wget curl coreutils jq bash tar grep sed | ||
| - name: Setup User for Mode | ||
| run: | | ||
| if [ "${{ matrix.user_mode }}" == "non-root" ]; then | ||
| # useradd is faster than the adduser Perl wrapper | ||
| sudo useradd -m -s /bin/bash tester | ||
| # Pre-create bin dir for the installer | ||
| sudo -u tester mkdir -p /home/tester/.local/bin | ||
|
|
||
| # Optimization: git checkout-index is instant compared to cp -r . | ||
| # it exports tracked files without the bulky .git folder (fixes 50s bottleneck) | ||
| mkdir -p /tmp/runpodctl-test | ||
| git checkout-index -a -f --prefix=/tmp/runpodctl-test/ | ||
| sudo chown -R tester:tester /tmp/runpodctl-test | ||
| fi | ||
| - name: Build and Install runpodctl | ||
| run: | | ||
| # 1. Build the local PR version (the "new" code) | ||
| go build -o runpodctl main.go | ||
| chmod +x runpodctl | ||
|
|
||
| # 2. Run installer as the correct user to validate PORTABILITY logic | ||
| if [ "${{ matrix.user_mode }}" == "root" ]; then | ||
| sudo bash install.sh | ||
| else | ||
| # Ensure the installer sees the tester's local bin | ||
| sudo -u tester env "PATH=$PATH:/home/tester/.local/bin" bash install.sh | ||
| fi | ||
|
|
||
| # 3. Overwrite with PR code so the tests below are testing the REAL changes | ||
| if [ "${{ matrix.user_mode }}" == "root" ]; then | ||
| sudo cp -f runpodctl /usr/local/bin/runpodctl | ||
| sudo chmod +x /usr/local/bin/runpodctl | ||
| mkdir -p ~/go/bin && cp runpodctl ~/go/bin/runpodctl | ||
| else | ||
| # Update the tester's binaries and satisfy upstream hardcoded paths | ||
| sudo cp -f runpodctl /home/tester/.local/bin/runpodctl | ||
| sudo -u tester mkdir -p /home/tester/go/bin | ||
| sudo cp runpodctl /home/tester/go/bin/runpodctl | ||
| sudo chown tester:tester /home/tester/.local/bin/runpodctl /home/tester/go/bin/runpodctl | ||
| sudo chmod +x /home/tester/.local/bin/runpodctl /home/tester/go/bin/runpodctl | ||
| fi | ||
| - name: Run Go E2E Tests | ||
| env: | ||
| RUNPOD_API_KEY: ${{ secrets.RUNPOD_API_KEY }} | ||
| RUNPOD_TEST_POD_IMAGE: ${{ github.event.inputs.pod_image || 'docker.io/library/alpine' }} | ||
| RUNPOD_TEST_SERVERLESS_IMAGE: ${{ github.event.inputs.serverless_image || 'alpine:latest' }} | ||
| run: | | ||
| # Use -run to ONLY execute our safe tests, but ./e2e/... to ensure package compilation | ||
| TEST_PATTERN="^TestE2E_CLILifecycle" | ||
|
|
||
| if [ "${{ matrix.user_mode }}" == "root" ]; then | ||
| go test -tags e2e -v -run "$TEST_PATTERN" ./e2e/... | ||
| else | ||
| # Execute the tests as the tester user, preserving path and env | ||
| sudo -u tester env "PATH=$PATH" "RUNPOD_API_KEY=${{ secrets.RUNPOD_API_KEY }}" \ | ||
| "RUNPOD_TEST_POD_IMAGE=${{ github.event.inputs.pod_image || 'docker.io/library/alpine' }}" \ | ||
| "RUNPOD_TEST_SERVERLESS_IMAGE=${{ github.event.inputs.serverless_image || 'alpine:latest' }}" \ | ||
| bash -c "cd /tmp/runpodctl-test && go test -tags e2e -v -run \"$TEST_PATTERN\" ./e2e/..." | ||
| fi | ||
| - name: Post-Run Cleanup (Emergency) | ||
| if: always() | ||
| env: | ||
| RUNPOD_API_KEY: ${{ secrets.RUNPOD_API_KEY }} | ||
| run: | | ||
| RP="./runpodctl" | ||
| if [ "${{ matrix.user_mode }}" == "non-root" ]; then | ||
| RP="/tmp/runpodctl-test/runpodctl" | ||
| fi | ||
|
|
||
| if [ -n "$RUNPOD_API_KEY" ]; then | ||
| echo "Ensuring safe sweeping of CI resources explicitly prefixed with 'ci-test-'..." | ||
| # Only delete pods named exactly starting with "ci-test-" | ||
| $RP pod list --output json 2>/dev/null | jq -r '.[] | select(.name | startswith("ci-test-")) | .id' | xargs -r -I {} $RP pod delete {} || true | ||
| $RP serverless list --output json 2>/dev/null | jq -r '.[] | select(.name | startswith("ci-test-")) | .id' | xargs -r -I {} $RP serverless delete {} || true | ||
| $RP template list --output json 2>/dev/null | jq -r '.[] | select(.name | startswith("ci-test-")) | .id' | xargs -r -I {} $RP template delete {} || true | ||
| fi | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,3 +19,6 @@ vendor/ | |
|
|
||
| ## auto generated file during make and release | ||
| version | ||
|
|
||
| # User built binaries | ||
| runpodctl | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should fix: the serverless test now creates templates with
ci-test-tpl-prefix, but the emergency cleanup only sweeps pods and serverless endpoints. if the test fails between template creation and endpoint creation (or ift.Cleanupdoesn't run), orphaned templates will be left behind.add a line to clean up templates too: