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

[wip]ci: add generate log files and upload to S3 bucket #1176

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
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
43 changes: 42 additions & 1 deletion .github/workflows/e2e-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
# this action requires node20, skip on AL2
if: ${{ steps.vars.outputs.has_creds == true && (!(startsWith(inputs.os, 'amazon') && inputs.version == '2' ))}}
if: ${{ steps.vars.outputs.has_creds == 'true' && (!(startsWith(inputs.os, 'amazon') && inputs.version == '2' ))}}
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: credhelper-test
Expand Down Expand Up @@ -90,6 +90,9 @@ jobs:
sudo systemctl start finch.service
sudo systemctl start finch-buildkit.service
sudo systemctl start finch-soci.service
- name: Set up REPORT_DIR
run: |
echo "REPORT_DIR=${{ github.workspace }}/reports" >> $GITHUB_ENV
- name: Run e2e tests
run: |
git status
Expand All @@ -98,6 +101,44 @@ jobs:
eval "$(ssh-agent -s)"
INSTALLED=true REGISTRY=${{ steps.vars.outputs.has_creds == true && env.REGISTRY || '' }} sudo -E make test-e2e-container
INSTALLED=true REGISTRY=${{ steps.vars.outputs.has_creds == true && env.REGISTRY || '' }} sudo -E make test-e2e-vm
- name: Change ownership of reports
if: always()
run: |
if [ ! -d "$REPORT_DIR" ]; then
echo "Error: Directory $REPORT_DIR does not exist."
exit 1
fi

USER=$(whoami)
GROUP=$(id -gn)

if sudo chown -R "$USER:$GROUP" "$REPORT_DIR"; then
echo "Ownership of $REPORT_DIR changed to $USER:$GROUP"
else
echo "Error: Failed to change ownership of $REPORT_DIR"
exit 1
fi
- name: Check and upload e2e tests reports to s3 bucket
if: always()
run: |
VM_REPORT="${{ github.workspace }}/reports/${{ github.run_id }}-${{ github.run_attempt }}-e2e-vm-report.json"
CONTAINER_REPORT="${{ github.workspace }}/reports/${{ github.run_id }}-${{ github.run_attempt }}-e2e-container-report.json"

if [ -f "$VM_REPORT" ]; then
echo "VM report file exists. Uploading to S3..."
aws s3 cp "$VM_REPORT" "s3://finch-e2e-test-log-reports/${{ inputs.os }}-${{ inputs.arch }}/${{ github.run_id }}-${{ github.run_attempt }}-e2e-vm-report.json"
echo "VM report uploaded successfully."
else
echo "VM report file does not exist. Skipping upload."
fi

if [ -f "$CONTAINER_REPORT" ]; then
echo "Container report file exists. Uploading to S3..."
aws s3 cp "$CONTAINER_REPORT" "s3://finch-e2e-test-log-reports/${{ inputs.os }}-${{ inputs.arch }}/${{ github.run_id }}-${{ github.run_attempt }}-e2e-container-report.json"
echo "Container report uploaded successfully."
else
echo "Container report file does not exist. Skipping upload."
fi
- name: Clean up repo AL2
if: ${{ (startsWith(inputs.os, 'amazon') && inputs.version == '2' && always() ) }}
run: |
Expand Down
36 changes: 33 additions & 3 deletions .github/workflows/e2e-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ jobs:
echo "has_creds=$has_creds" >> $GITHUB_OUTPUT
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
if: ${{ steps.vars.outputs.has_creds == true }}
if: ${{ steps.vars.outputs.has_creds == 'true' }}
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: credhelper-test
aws-region: ${{ secrets.REGION }}
aws-region: ${{ secrets.REGION }}
- name: Clean up previous files
run: |
sudo rm -rf /opt/finch
Expand All @@ -65,7 +65,7 @@ jobs:
fi
if pgrep '^socket_vmnet'; then
sudo pkill '^socket_vmnet'
fi
fi
- name: Install Rosetta 2
run: echo "A" | softwareupdate --install-rosetta || true
- run: brew install lz4 automake autoconf libtool yq
Expand All @@ -81,3 +81,33 @@ jobs:
git clean -f -d
REGISTRY=${{ steps.vars.outputs.has_creds == true && env.REGISTRY || '' }} make ${{ inputs.test-command }}
shell: zsh {0}
- name: Check and upload e2e tests reports to s3 bucket
if: always()
run: |
VM_REPORT="${{ github.workspace }}/reports/${{ github.run_id }}-${{ github.run_attempt }}-e2e-vm-report.json"
CONTAINER_REPORT="${{ github.workspace }}/reports/${{ github.run_id }}-${{ github.run_attempt }}-e2e-container-report.json"
VM_SERIAL_REPORT="${{ github.workspace }}/reports/${{ github.run_id }}-${{ github.run_attempt }}-e2e-vm-serial-report.json"

if [ -f "$VM_REPORT" ]; then
echo "VM report file exists. Uploading to S3..."
aws s3 cp "$VM_REPORT" "s3://finch-e2e-test-log-reports/${{ inputs.os }}-${{ inputs.arch }}/${{ github.run_id }}-${{ github.run_attempt }}-e2e-vm-report.json"
echo "VM report uploaded successfully."
else
echo "VM report file does not exist. Skipping upload."
fi

if [ -f "$CONTAINER_REPORT" ]; then
echo "Container report file exists. Uploading to S3..."
aws s3 cp "$CONTAINER_REPORT" "s3://finch-e2e-test-log-reports/${{ inputs.os }}-${{ inputs.arch }}/${{ github.run_id }}-${{ github.run_attempt }}-e2e-container-report.json"
echo "Container report uploaded successfully."
else
echo "Container report file does not exist. Skipping upload."
fi

if [ -f "$VM_SERIAL_REPORT" ]; then
echo "VM serial report file exists. Uploading to S3..."
aws s3 cp "$VM_SERIAL_REPORT" "s3://finch-e2e-test-log-reports/${{ inputs.os }}-${{ inputs.arch }}/${{ github.run_id }}-${{ github.run_attempt }}-e2e-vm-serial-report.json"
echo "VM serial report uploaded successfully."
else
echo "VM serial report file does not exist. Skipping upload."
fi
32 changes: 31 additions & 1 deletion .github/workflows/e2e-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
with:
role-to-assume: ${{ secrets.ROLE }}
role-session-name: credhelper-test
aws-region: ${{ secrets.REGION }}
aws-region: ${{ secrets.REGION }}
- name: Remove Finch VM
timeout-minutes: 2
run: |
Expand Down Expand Up @@ -89,6 +89,36 @@ jobs:
git status
git clean -f -d
make ${{ inputs.test-command }}
- name: Check and upload e2e tests reports to s3 bucket
if: ${{ always() }}
run: |
$VM_REPORT="${{ github.workspace }}/reports/${{ github.run_id }}-${{ github.run_attempt }}-e2e-vm-report.json"
$CONTAINER_REPORT="${{ github.workspace }}/reports/${{ github.run_id }}-${{ github.run_attempt }}-e2e-container-report.json"
$VM_SERIAL_REPORT="${{ github.workspace }}/reports/${{ github.run_id }}-${{ github.run_attempt }}-e2e-vm-serial-report.json"

if (Test-Path $VM_REPORT) {
Write-Host "VM report file exists. Uploading to S3..."
aws s3 cp $VM_REPORT "s3://finch-e2e-test-log-reports/${{ inputs.os }}-${{ inputs.arch }}/${{ github.run_id }}-${{ github.run_attempt }}-e2e-vm-report.json"
Write-Host "VM report uploaded successfully."
} else {
Write-Host "VM report file does not exist. Skipping upload."
}

if (Test-Path $CONTAINER_REPORT) {
Write-Host "Container report file exists. Uploading to S3..."
aws s3 cp $CONTAINER_REPORT "s3://finch-e2e-test-log-reports/${{ inputs.os }}-${{ inputs.arch }}/${{ github.run_id }}-${{ github.run_attempt }}-e2e-container-report.json"
Write-Host "Container report uploaded successfully."
} else {
Write-Host "Container report file does not exist. Skipping upload."
}

if (Test-Path $VM_SERIAL_REPORT) {
Write-Host "VM serial report file exists. Uploading to S3..."
aws s3 cp $VM_SERIAL_REPORT "s3://finch-e2e-test-log-reports/${{ inputs.os }}-${{ inputs.arch }}/${{ github.run_id }}-${{ github.run_attempt }}-e2e-vm-serial-report.json.json"
Write-Host "VM serial report uploaded successfully."
} else {
Write-Host "VM serial report file does not exist. Skipping upload."
}
- name: Remove Finch VM and Clean Up Previous Environment
if: ${{ always() }}
timeout-minutes: 2
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ DEST := $(shell echo "$(DESTDIR)/$(PREFIX)" | sed 's:///*:/:g; s://*$$::')
BINDIR ?= /usr/local/bin
OUTDIR ?= $(CURDIR)/_output
OS_OUTDIR ?= $(OUTDIR)/os
REPORT_DIR ?= $(CURDIR)/reports
RUN_ID ?= $(GITHUB_RUN_ID)
RUN_ATTEMPT ?= $(GITHUB_RUN_ATTEMPT)

OUTPUT_DIRECTORIES := $(OUTDIR) $(OS_OUTDIR)
$(OUTPUT_DIRECTORIES):
Expand Down Expand Up @@ -266,15 +269,15 @@ test-e2e: test-e2e-vm-serial test-e2e-container

.PHONY: test-e2e-vm-serial
test-e2e-vm-serial:
go test -ldflags $(LDFLAGS) -timeout 2h ./e2e/vm -test.v -ginkgo.v -ginkgo.timeout=2h --installed="$(INSTALLED)"
go test -ldflags $(LDFLAGS) -timeout 2h ./e2e/vm -test.v -ginkgo.v -ginkgo.timeout=2h -ginkgo.json-report=$(REPORT_DIR)/$(RUN_ID)-$(RUN_ATTEMPT)-e2e-vm-serial-report.json --installed="$(INSTALLED)"

.PHONY: test-e2e-container
test-e2e-container:
go test -ldflags $(LDFLAGS) -timeout 2h ./e2e/container -test.v -ginkgo.v -ginkgo.timeout=2h --installed="$(INSTALLED)"
go test -ldflags $(LDFLAGS) -timeout 2h ./e2e/container -test.v -ginkgo.v -ginkgo.timeout=2h -ginkgo.json-report=$(REPORT_DIR)/$(RUN_ID)-$(RUN_ATTEMPT)-e2e-container-report.json --installed="$(INSTALLED)"

.PHONY: test-e2e-vm
test-e2e-vm:
go test -ldflags $(LDFLAGS) -timeout 2h ./e2e/vm -test.v -ginkgo.v -ginkgo.timeout=2h --installed="$(INSTALLED)" --registry="$(REGISTRY)"
go test -ldflags $(LDFLAGS) -timeout 2h ./e2e/vm -test.v -ginkgo.v -ginkgo.timeout=2h -ginkgo.json-report=$(REPORT_DIR)/$(RUN_ID)-$(RUN_ATTEMPT)-e2e-vm-report.json --installed="$(INSTALLED)" --registry="$(REGISTRY)"

.PHONY: test-benchmark
test-benchmark:
Expand Down
Loading