Skip to content

Commit

Permalink
test: fix github actions
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Mitchell <[email protected]>
  • Loading branch information
starpit authored and aavarghese committed Jul 18, 2024
1 parent 2f2fb38 commit 4d8c831
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 34 deletions.
37 changes: 13 additions & 24 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Kind
name: CI Tests

# cancel any prior runs for this workflow and this PR (or branch)
concurrency:
Expand All @@ -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:
Expand All @@ -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/[email protected]
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 }}"
1 change: 1 addition & 0 deletions charts/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.helmignore
.DS_Store
.cache
LICENSE

# these will all be pulled in from Chart.yaml as dependencies
/core
Expand Down
6 changes: 4 additions & 2 deletions pkg/fe/assembler/stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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") != "" {
// [email protected]:user/repo.git -> https://patuser:[email protected]/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#")
Expand Down
6 changes: 3 additions & 3 deletions pkg/lunchpail/images/build/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
4 changes: 3 additions & 1 deletion tests/bin/deploy-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test7f-external/settings.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test7f-repo/pail/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test8/settings.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test8b/settings.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 4d8c831

Please sign in to comment.