✨ adding reflection client to determine what provider provides #1383
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Demo Testing | |
on: ["push", "pull_request"] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
outputs: | |
api_tests_ref: ${{ steps.extract-info.outputs.API_TESTS_REF }} | |
steps: | |
- name: Extract pull request number from inputs or PR description | |
id: extract-info | |
env: | |
PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} | |
run: | | |
# if this is a PR, we should use the base branch | |
# else, use the branch on which this is running | |
if [ ! -z ${GITHUB_BASE_REF} ]; then | |
echo "Using ${GITHUB_BASE_REF}" | |
echo "API_TESTS_REF=${GITHUB_BASE_REF}" >> $GITHUB_OUTPUT | |
echo "ADDON_REF=${GITHUB_BASE_REF}" >>$GITHUB_ENV | |
else | |
echo "Using ${GITHUB_REF_NAME}" | |
echo "API_TESTS_REF=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | |
echo "ADDON_REF=${GITHUB_REF_NAME}" >>$GITHUB_ENV | |
fi | |
# override with explicitely set value in PR description | |
echo "${PULL_REQUEST_BODY}" | |
PULL_REQUEST_NUMBER=$(echo "${PULL_REQUEST_BODY}" | grep -oP '[A|a]ddon [P|p][R|r]: \K\d+' || true) | |
if [ ! -z "$PULL_REQUEST_NUMBER" ]; then | |
echo "Using pull/${PULL_REQUEST_NUMBER} for addon" | |
echo "ADDON_REF=refs/pull/$PULL_REQUEST_NUMBER/merge" >>$GITHUB_ENV | |
fi | |
- uses: actions/checkout@v3 | |
# build all provider images and the analyzer-lsp image | |
- name: build images | |
run: | | |
make build-external | |
podman build -t quay.io/konveyor/analyzer-lsp:latest -f Dockerfile . | |
# run: | | |
# function build_image { | |
# dir=$1 | |
# name=$2 | |
# pushd ${dir} | |
# go mod edit -replace=github.com/konveyor/analyzer-lsp=/analyzer-lsp | |
# podman build -t quay.io/konveyor/${name}:latest -f Dockerfile ../../ | |
# popd | |
# } | |
# pushd ./external-providers/ | |
# build_image golang-dependency-provider golang-dependency-provider | |
# build_image java-external-provider java-external-provider | |
# build_image yq-external-provider yq-external-provider | |
# build_image generic-external-provider generic-external-provider | |
# popd | |
# run the demo in a podman pod | |
- name: run demo image | |
run : | | |
make run-external-providers-pod | |
podman build -f demo-local.Dockerfile -t localhost/testing:latest | |
make run-demo-image | |
# run: | | |
# function run_provider { | |
# name=$1 | |
# img=$2 | |
# port=$3 | |
# podman run -d --pod analyzer --name ${name} -v test-data:/analyzer-lsp/examples/:Z \ | |
# quay.io/konveyor/${img}:latest --port ${port} | |
# } | |
# mkdir /tmp/examples/ && \ | |
# cp -r examples/* /tmp/examples/ && \ | |
# cp -r ./external-providers/java-external-provider/examples/* /tmp/examples/ | |
# podman volume create test-data | |
# podman run --rm -v test-data:/target -v /tmp/examples/:/src/:Z \ | |
# --entrypoint=cp alpine -a /src/. /target/ | |
# podman pod create --name=analyzer | |
# run_provider golang generic-external-provider 9999 | |
# run_provider nodejs generic-external-provider 9998 | |
# run_provider python generic-external-provider 9997 | |
# run_provider java java-external-provider 9996 | |
# run_provider yq yq-external-provider 9995 | |
# jq 'map( | |
# if .name == "go" then del(.binaryPath) | .address = "localhost:9999" | |
# elif .name == "nodejs" then del(.binaryPath) | .address = "localhost:9998" | |
# elif .name == "python" then del(.binaryPath) | .address = "localhost:9997" | |
# elif .name == "java" then del(.binaryPath) | .address = "localhost:9996" | |
# elif .name == "yaml" then del(.binaryPath) | .address = "localhost:9995" | |
# else . | |
# end | |
# )' provider_container_settings.json | tee provider_container_settings.json | |
# podman build -f demo.Dockerfile -t localhost/testing:latest | |
# podman run --entrypoint /usr/local/bin/konveyor-analyzer \ | |
# --pod=analyzer \ | |
# -v $(pwd)/demo-dep-output.yaml:/analyzer-lsp/demo-dep-output.yaml:Z \ | |
# -v $(pwd)/demo-output.yaml:/analyzer-lsp/output.yaml:Z \ | |
# localhost/testing:latest --dep-output-file=demo-dep-output.yaml | |
- name: install yq for testing | |
run: go install github.com/mikefarah/yq/v4@latest | |
- name: ensure violation and dependency outputs are unchanged | |
run: | | |
diff \ | |
<(yq -P 'sort_keys(..)' -o=props <(git show HEAD:demo-output.yaml)) \ | |
<(yq -P 'sort_keys(..)' -o=props <(cat demo-output.yaml)) | |
diff \ | |
<(yq -P 'sort_keys(..)' -o=props <(git show HEAD:demo-dep-output.yaml)) \ | |
<(yq -P 'sort_keys(..)' -o=props <(cat demo-dep-output.yaml)) | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
repository: konveyor/tackle2-addon-analyzer | |
ref: "${{ env.ADDON_REF}}" | |
path: tackle2-addon-analyzer | |
- name: Build addon and save image | |
working-directory: tackle2-addon-analyzer | |
run: | | |
IMG=quay.io/konveyor/tackle2-addon-analyzer:latest make image-podman | |
podman save -o /tmp/tackle2-addon-analyzer.tar quay.io/konveyor/tackle2-addon-analyzer:latest | |
- name: Upload image as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tackle2-addon-analyzer | |
path: /tmp/tackle2-addon-analyzer.tar | |
retention-days: 1 | |
e2e: | |
needs: test | |
uses: konveyor/ci/.github/workflows/global-ci.yml@main | |
with: | |
component_name: tackle2-addon-analyzer | |
api_tests_ref: "${{ needs.test.outputs.api_tests_ref }}" |