From 4d8c831a7d8f7f70c9d06aec269076e33e8226c4 Mon Sep 17 00:00:00 2001 From: Nick Mitchell Date: Wed, 17 Jul 2024 16:00:50 -0400 Subject: [PATCH] test: fix github actions Signed-off-by: Nick Mitchell --- .github/workflows/actions.yml | 37 +++++++++---------------- charts/.helmignore | 1 + pkg/fe/assembler/stage.go | 6 ++-- pkg/lunchpail/images/build/podman.go | 6 ++-- tests/bin/deploy-tests.sh | 4 ++- tests/tests/test7f-external/settings.sh | 2 +- tests/tests/test7f-repo/pail/app.yaml | 2 +- tests/tests/test8/settings.sh | 2 +- tests/tests/test8b/settings.sh | 2 +- 9 files changed, 28 insertions(+), 34 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 9f2aad06..f682f074 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -1,4 +1,4 @@ -name: Kind +name: CI Tests # cancel any prior runs for this workflow and this PR (or branch) concurrency: @@ -12,15 +12,16 @@ on: branches: [ main ] jobs: - testsh: + ci: runs-on: ${{ matrix.os }} strategy: matrix: - ARGS: - - "-e 'test(7.*|8.*)'" # baseline tests - - "-i 'test7.*' -e 'test8.*'" # including only test7* tests (simpler tests) - - "-i 'test8.*' -e 'test7.*'" # including only test8* tests (application tests) + SCRIPT: + - ./tests/bin/ci.sh -e 'test(7.*|8.*)' # baseline tests + - ./tests/bin/ci.sh -i 'test7.*' -e 'test8.*' # including only test7* tests (simpler tests) + - ./tests/bin/ci.sh -i 'test8.*' -e 'test7.*' # including only test8* tests (application tests) + - ./tests/bin/go.sh os: [ubuntu-latest] steps: @@ -34,22 +35,10 @@ jobs: - name: Setup run: ./tests/bin/travis/setup.sh - - name: Run Test with args ${{ matrix.ARGS }} - run: bash -c "./tests/bin/ci.sh ${{matrix.ARGS }}" - - gosh: - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 + - name: Check Docker + run: docker version && podman version - - name: Create k8s Kind Cluster - uses: helm/kind-action@v1.10.0 - with: - install_only: true - - - name: Setup - run: ./tests/bin/travis/setup.sh - - - name: Run Go Tests - run: ./tests/bin/go.sh + - name: Run Test with args ${{ matrix.ARGS }} + env: + TERM: xterm-256color + run: bash -c "${{matrix.SCRIPT}} ${{matrix.ARGS }}" diff --git a/charts/.helmignore b/charts/.helmignore index a92a4bcf..b7a6dc12 100644 --- a/charts/.helmignore +++ b/charts/.helmignore @@ -5,6 +5,7 @@ .helmignore .DS_Store .cache +LICENSE # these will all be pulled in from Chart.yaml as dependencies /core diff --git a/pkg/fe/assembler/stage.go b/pkg/fe/assembler/stage.go index 73721f91..cf095748 100644 --- a/pkg/fe/assembler/stage.go +++ b/pkg/fe/assembler/stage.go @@ -34,8 +34,10 @@ func copyAppIntoTemplate(appname, sourcePath, templatePath, branch string, verbo fmt.Fprintf(os.Stderr, "Copying app templates into %s\n", appdir) } - if strings.HasPrefix(sourcePath, "git@") { - if os.Getenv("CI") != "" && os.Getenv("AI_FOUNDATION_GITHUB_USER") != "" { + isGitSsh := strings.HasPrefix(sourcePath, "git@") + isGitHttp := !isGitSsh && strings.HasPrefix(sourcePath, "https:") + if isGitSsh || isGitHttp { + if isGitSsh && os.Getenv("CI") != "" && os.Getenv("AI_FOUNDATION_GITHUB_USER") != "" { // git@github.ibm.com:user/repo.git -> https://patuser:pat@github.ibm.com/user/repo.git pattern := regexp.MustCompile("^git@([^:]+):([^/]+)/([^.]+)[.]git$") // apphttps := $(echo $appgit | sed -E "s#^git\@([^:]+):([^/]+)/([^.]+)[.]git\$#https://${AI_FOUNDATION_GITHUB_USER}:${AI_FOUNDATION_GITHUB_PAT}@\1/\2/\3.git#") diff --git a/pkg/lunchpail/images/build/podman.go b/pkg/lunchpail/images/build/podman.go index d03bd5bd..ac369961 100644 --- a/pkg/lunchpail/images/build/podman.go +++ b/pkg/lunchpail/images/build/podman.go @@ -13,10 +13,10 @@ const ( ) func WhichContainerCli() (ContainerCli, error) { - if which.Found("podman") { - return "podman", nil - } else if which.Found("docker") { + if which.Found("docker") { return "docker", nil + } else if which.Found("podman") { + return "podman", nil } else { return "", fmt.Errorf("No container CLI found") } diff --git a/tests/bin/deploy-tests.sh b/tests/bin/deploy-tests.sh index 6d2719ba..67d6e049 100755 --- a/tests/bin/deploy-tests.sh +++ b/tests/bin/deploy-tests.sh @@ -61,13 +61,15 @@ testapp="$TARGET"/test # Allows us to capture workstealer info before it auto-terminates export LP_SLEEP_BEFORE_EXIT=10 +repo_secret="" # e.g. user:pat@https://github.mycompany.com + # intentionally setting some critical values at assemble time to the # final value, and some critical values to bogus values that are then # overridden by final values at shrinkwrap time /tmp/lunchpail assemble -v \ -o $testapp \ $branch \ - --repo-secret $AI_FOUNDATION_GITHUB_USER:$AI_FOUNDATION_GITHUB_PAT@https://github.ibm.com \ + $repo_secret \ $2 $testapp up \ diff --git a/tests/tests/test7f-external/settings.sh b/tests/tests/test7f-external/settings.sh index dcb07426..30b431ea 100644 --- a/tests/tests/test7f-external/settings.sh +++ b/tests/tests/test7f-external/settings.sh @@ -1,5 +1,5 @@ api=workqueue -app=git@github.ibm.com:cloud-computer/lunchpail-demo.git +app=https://github.com/IBM/lunchpail-demo.git branch=v0.0.15 deployname=lunchpail-demo diff --git a/tests/tests/test7f-repo/pail/app.yaml b/tests/tests/test7f-repo/pail/app.yaml index 4fc19e93..d2e0b100 100644 --- a/tests/tests/test7f-repo/pail/app.yaml +++ b/tests/tests/test7f-repo/pail/app.yaml @@ -5,7 +5,7 @@ metadata: spec: api: workqueue role: worker - repo: https://github.ibm.com/cloud-computer/lunchpail/tree/main/tests/tests/test7f-repo/pail + repo: https://github.com/IBM/lunchpail/tree/main/tests/tests/test7f-repo/pail command: ./src/main.sh image: {{ print .Values.global.image.registry "/" .Values.global.image.repo "/worker-alpine:" .Chart.AppVersion }} env: diff --git a/tests/tests/test8/settings.sh b/tests/tests/test8/settings.sh index af405024..68ec2167 100644 --- a/tests/tests/test8/settings.sh +++ b/tests/tests/test8/settings.sh @@ -1,5 +1,5 @@ api=workqueue -app=git@github.ibm.com:mceda/lunchpail-openroad-max-utilization.git +app=https://github.com/IBM/lunchpail-openroad-max-utilization.git branch=v0.1.0 deployname=lunchpail-openroad-max-utilization diff --git a/tests/tests/test8b/settings.sh b/tests/tests/test8b/settings.sh index af405024..68ec2167 100644 --- a/tests/tests/test8b/settings.sh +++ b/tests/tests/test8b/settings.sh @@ -1,5 +1,5 @@ api=workqueue -app=git@github.ibm.com:mceda/lunchpail-openroad-max-utilization.git +app=https://github.com/IBM/lunchpail-openroad-max-utilization.git branch=v0.1.0 deployname=lunchpail-openroad-max-utilization