Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
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
72 changes: 72 additions & 0 deletions .github/actions/tests-linux-containerless/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CLI container-less on Linux

inputs:
tag:
description: |
Tag release
required: false
type: string
default: latest
tier:
description: |
Test TIER name
required: false
type: string
default: TIER0

runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '21'
- run: java --version
shell: bash
- name: Set up Igor's kantra installer
shell: bash
run: |
git clone https://github.com/ibragins/konveyor-cli-deployment.git
cd konveyor-cli-deployment
pip install -r requirements.txt
echo '{"misc_downstream_path": "","temp_dir": "","extract_binary": "","get_images_output": "","bundle": "","no_brew": "","ssh_user": "","ssh_key": ""}' >> config.json
# Workaround ruleset home (?)
mkdir -p /home/runner/.config
./install_cli.py --upstream true
cd ..
chmod +x /home/runner/.kantra/kantra
/home/runner/.kantra/kantra --help

- name: Configure Test Environment Variables
shell: bash
run: |
cp .env.example .env
mkdir ${{ github.workspace }}/report

> .env
echo "KANTRA_CLI_PATH=/home/runner/.kantra/kantra" >> .env
echo "REPORT_OUTPUT_PATH=${{ github.workspace }}/report" >> .env
echo "PROJECT_PATH=${{ github.workspace }}" >> .env
Comment on lines +48 to +50
Copy link
Collaborator

@abrugaro abrugaro Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .env file also need to configure the followin properties for analysis test on private repos:

  • GIT_USERNAME
  • GIT_PASSWORD

This can be configured in a follow-up PR as the test that you're running right now is not using these properties.

Edit: I see the ci failures, I believe those can be addressed in next prs but we can merge this initial work, wdyt @ibragins ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abrugaro git credentials are required for some tests only, CI purpose is to run BASIC tests, so actually those parameters can stay blanked.
Regarding failures - I would like to solve them before merging if failures are related to the changes that this PR brings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for feedback!

  • credentials - correct, should be setup in these workflows once we add an application that needs credentials (so likely in one of following PRs)
  • failures - this PR adds github workflows, so those failures doesn't change any existing test. Based on our recent discussion, going to address those failures on a fresh simple analysis test case in TIER0 analysis tests with full results assertion #48 (that most likely will modify test workflows to allow pass the given analysis test case)


cat .env
# Set test tier to ENV variable (could be changed)
export ${{ inputs.tier }}=1
working-directory: ${{ github.workspace }}
- name: Install test dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

# TODO: Run test for TIER0
- name: Run simple standard analysis test
shell: bash
run: |
pytest -s -k "jee_example_app and not bug"

- name: Save analysis output
uses: actions/upload-artifact@v4
with:
name: kantra-outputs
path: ${{ github.workspace }}/report
81 changes: 81 additions & 0 deletions .github/actions/tests-linux-containers/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CLI containes on Linux

inputs:
tag:
description: |
Tag release
required: false
type: string
default: latest
tier:
description: |
Test TIER name
required: false
type: string
default: TIER0

runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Upgrade podman # TODO: little strange, copied from kantra demo testing workflow.
shell: bash
run: |
sudo apt-get install -y ansible
export DEB=$(curl -s https://passt.top/builds/latest/x86_64/ | grep deb | awk -F '"' '{ print $4}')
sudo ansible -m apt -a deb=https://passt.top/builds/latest/x86_64/${DEB} localhost
sudo apt-get remove podman crun
brew install crun podman
- run: podman --help
shell: bash
- name: Set up Igor's kantra installer
shell: bash
run: |
git clone https://github.com/ibragins/konveyor-cli-deployment.git
cd konveyor-cli-deployment
pip install -r requirements.txt
echo '{"misc_downstream_path": "","temp_dir": "","extract_binary": "","get_images_output": "","bundle": "","no_brew": "","ssh_user": "","ssh_key": ""}' >> config.json
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least empty values are needed with current version of konveyor-cli-deployment

# Workaround ruleset home (?)
mkdir -p /home/runner/.config
./install_cli.py --upstream true
cd ..
chmod +x /home/runner/.kantra/kantra
/home/runner/.kantra/kantra --help

- name: Configure Test Environment Variables
shell: bash
run: |
cp .env.example .env
mkdir ${{ github.workspace }}/report

> .env
echo "KANTRA_CLI_PATH=/home/runner/.kantra/kantra" >> .env
echo "REPORT_OUTPUT_PATH=${{ github.workspace }}/report" >> .env
echo "PROJECT_PATH=${{ github.workspace }}" >> .env

cat .env
# Set test tier to ENV variable (could be changed)
export ${{ inputs.tier }}=1

# Temporary dirty workaround to execute container kantra (with run-local=false)
sed -i 's/ analyze / analyze --run-local=false /g' utils/command.py
working-directory: ${{ github.workspace }}
- name: Install test dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

# TODO: Run test for TIER0
- name: Run simple standard analysis test
shell: bash
run: |
pytest -s -k "jee_example_app and not bug"

- name: Save analysis output
uses: actions/upload-artifact@v4
with:
name: kantra-outputs
path: ${{ github.workspace }}/report
72 changes: 72 additions & 0 deletions .github/actions/tests-windows-containerless/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CLI container-less on Windows

inputs:
tag:
description: |
Tag release
required: false
type: string
default: latest
tier:
description: |
Test TIER name
required: false
type: string
default: TIER0

runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '21'
- run: java --version
shell: cmd
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- run: python -m pip install --upgrade pip
shell: cmd
- name: Set up Igor's kantra installer
shell: cmd
run: |
git clone https://github.com/ibragins/konveyor-cli-deployment.git
cd konveyor-cli-deployment
pip install -r requirements.txt
REM Error parsing json, trying just dummy example file, might be OK for upstream
cp config.json.example config.json
REM TODO: Use ${{ inputs.tag }} to specify required kantra version
python install_cli.py --upstream true
C:\Users\runneradmin\.kantra\windows-kantra.exe --help

- name: Configure Test Environment Variables
shell: cmd
run: |
cp .env.example .env

echo "KANTRA_CLI_PATH=C:\Users\runneradmin\.kantra\windows-kantra.exe" >> .env
echo "REPORT_OUTPUT_PATH=${{ github.workspace }}\report" >> .env
echo "PROJECT_PATH=${{ github.workspace }}" >> .env
REM # Set test tier to ENV variable (could be changed)
set ${{ inputs.tier }}=1
working-directory: ${{ github.workspace }}
- name: Install test dependencies
shell: cmd
run: |
pip install -r requirements.txt
mkdir ${{ github.workspace }}\report

# TODO: Run test for TIER0
- name: Run simple standard analysis test
shell: cmd
run: |
pytest -s -k "jee_example_app and not bug"

- name: Save analysis output
uses: actions/upload-artifact@v4
with:
name: kantra-outputs
path: ${{ github.workspace }}\report
12 changes: 12 additions & 0 deletions .github/workflows/nightly-main-latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Nightly CLI test for main

on:
schedule:
- cron: '08 1,13 * * *'

jobs:
test-suite:
uses: aufi/kantra-cli-tests/.github/workflows/test-suite.yaml@basic-workflows # Replace with konveyor-ecosystem (cannot do checkout before for different OSs)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will replace aufi fork in followup PRs, this is actually faster to execute tests with modified actions, also the workflow would fail immediately on not existing actions since it is not yet merged in main branch.

with:
tag: latest
tier: TIER0
18 changes: 18 additions & 0 deletions .github/workflows/pr-gating-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR/push CLI tests for main

on:
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
push:
branches: [ "main" ]
paths-ignore:
- '**.md'

jobs:
test-suite:
uses: aufi/kantra-cli-tests/.github/workflows/test-suite.yaml@basic-workflows # Replace with konveyor-ecosystem (cannot do checkout before for different OSs)
with:
tag: latest
tier: TIER0
49 changes: 49 additions & 0 deletions .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CLI test suite

on:
workflow_call:
inputs:
tag:
description: |
Tag release
required: false
type: string
default: latest
tier:
description: |
Test TIER name
required: false
type: string
default: TIER0

jobs:
tests-windows-containerless:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Windows container-less tests
uses: ./.github/actions/tests-windows-containerless
with:
tag: ${{ inputs.tag }}
tier: ${{ inputs.tier }}

tests-linux-containerless:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Linux container-less tests
uses: ./.github/actions/tests-linux-containerless
with:
tag: ${{ inputs.tag }}
tier: ${{ inputs.tier }}


tests-linux-containers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Linux containers tests
uses: ./.github/actions/tests-linux-containers
with:
tag: ${{ inputs.tag }}
tier: ${{ inputs.tier }}
Loading