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

add buider #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
70 changes: 70 additions & 0 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: builder

on:
push:
branches:
- "main"
pull_request:

env:
OCI_E2E_NAME: libhvee-e2e
CORRELATE: ${{ github.sha }}

jobs:
save-gh-context:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Save GH context
shell: bash
env:
GH_CONTEXT: ${{ toJSON(github) }}
run: echo $GH_CONTEXT > gh_context.json

- name: Upload GH context as an artifact
uses: actions/upload-artifact@v4
with:
name: gh_context
path: ./gh_context.json

build-oci-e2e:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Build and archive e2e image
run: |
VERSION=${{ env.CORRELATE}} make build-oci-e2e
podman save -o ${{ env.OCI_E2E_NAME }}.tar quay.io/rhqp/${{ env.OCI_E2E_NAME}}:v${{ env.CORRELATE }}

- name: Upload e2e flat image as artifact
uses: actions/upload-artifact@v4
with:
name: libhvee-e2e-v${{ env.CORRELATE }}
path: libhvee-e2e.tar

build-executables:
runs-on: windows-2022
strategy:
fail-fast: false
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.18'

- name: Build libhvee executables
run: make build

- name: Upload libhvee executables as artifact
uses: actions/upload-artifact@v4
with:
name: libhvee-v${{ env.CORRELATE }}
path: bin/*.exe
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export GOOS=windows
export GOARCH=amd64
SRC = $(shell find . -type f -name '*.go')
VERSION ?= 0.0.1
IMG ?= quay.io/rhqp/libhvee-e2e:v${VERSION}
CONTAINER_MANAGER ?= podman

.PHONY: default
default: build
Expand Down Expand Up @@ -37,3 +40,7 @@ bin/updatevm.exe: $(SRC) go.mod go.sum

clean:
rm -rf bin

.PHONY: build-oci-e2e
build-oci-e2e:
${CONTAINER_MANAGER} build -t ${IMG} -f oci/e2e/Containerfile --build-arg=OS=${GOOS} --build-arg=ARCH=${GOARCH} .
29 changes: 29 additions & 0 deletions docs/e2e.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# e2e

TBC

## Container

Build container image

```bash
make build-oci-e2e
```

Sample for running the container with e2e on remote target

```bash
podman run --rm -it --name libhvee-e2e \
-e TARGET_HOST=$(cat host) \
-e TARGET_HOST_USERNAME=$(cat username) \
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
-e TARGET_FOLDER=libhvee-e2e \
-e TARGET_RESULTS=libhvee-e2e.xml \
-e OUTPUT_FOLDER=/data \
-e DEBUG=true \
-v $PWD:/data:z \
quay.io/rhqp/libhvee-e2e:v0.0.1 \
libhvee-e2e/run.ps1 \
-targetFolder libhvee-e2e \
-junitResultsFilename libhvee-e2e.xml
```
23 changes: 23 additions & 0 deletions oci/e2e/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

FROM registry.access.redhat.com/ubi9/go-toolset:1.18 as builder

COPY . .

ARG OS
ARG ARCH

RUN GOOS=${OS} GOARCH=${ARCH} go test -v test/e2e/*.go -c -o ./build/libhvee-e2e.exe

FROM quay.io/rhqp/deliverest:v0.0.3

ARG OS
ARG ARCH

ENV ASSETS_FOLDER=/opt/libhvee-e2e \
OS=${OS} \
ARCH=${ARCH}

# LABEL org.opencontainpoders.image.authors="Adrian Riobo<[email protected]>"

COPY --from=builder /opt/app-root/src/build/libhvee-e2e.exe ${ASSETS_FOLDER}/
COPY oci/e2e/run.ps1 ${ASSETS_FOLDER}/
10 changes: 10 additions & 0 deletions oci/e2e/run.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
param(
[Parameter(Mandatory,HelpMessage='folder on target host where assets are copied')]
$targetFolder,
[Parameter(Mandatory,HelpMessage='junit results filename')]
$junitResultsFilename
)

# Run e2e
$env:PATH="$env:PATH;$env:HOME\$targetFolder;"
libhvee-e2e.exe --ginkgo.vv --ginkgo.junit-report="$targetFolder/$junitResultsFilename"