From d62b5f8bc7e9b1a2a0d4642ec56ca069e509510e Mon Sep 17 00:00:00 2001 From: Maayan Hadasi <60384172+mguetta1@users.noreply.github.com> Date: Wed, 28 Aug 2024 16:52:51 +0300 Subject: [PATCH] Moved binary analysis to TIER0 (#161) Signed-off-by: Maayan Hadasi --- Makefile | 7 +- analysis/tc_tackle_testapp_public.go | 113 ------------------ ....go => tc_tackle_testapp_public_binary.go} | 6 +- analysis/tc_tackle_testapp_public_deps.go | 10 +- ...tc_tackle_testapp_public_package_filter.go | 11 +- analysis/test_cases.go | 3 +- data/{application_data.go => application.go} | 10 +- .../{identity_data.go => identity.go} | 12 +- go-konveyor-tests.config | 2 - 9 files changed, 26 insertions(+), 148 deletions(-) delete mode 100644 analysis/tc_tackle_testapp_public.go rename analysis/{tc_tackle_testapp_private_binary.go => tc_tackle_testapp_public_binary.go} (97%) rename data/{application_data.go => application.go} (84%) rename data/identity/{identity_data.go => identity.go} (76%) diff --git a/Makefile b/Makefile index 6911a30..888d8a0 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,6 @@ VENDOR_DIR ?= /tmp/konveyor-vendor ARCH ?= amd64 JUNIT_REPORT_DIR ?= /tmp/junit-report -# Set MAVEN_TESTAPP_USER to the value of GITHUB_USER if GITHUB_USER is defined -MAVEN_TESTAPP_USER ?= $(GITHUB_USER) -MAVEN_TESTAPP_TOKEN ?= $(GITHUB_TOKEN) - - # Setup local minikube with tackle - work in progress (TODO: enable auth) # This is for local setup, CI uses shared github actions setup: @@ -48,9 +43,9 @@ test-tier2: # TIER3 test-tier3: - TIER3=1 MAVEN_TESTAPP_USER='$(MAVEN_TESTAPP_USER)' MAVEN_TESTAPP_TOKEN='$(MAVEN_TESTAPP_TOKEN)' $(MAKE) test-analysis $(MAKE) test-jira $(MAKE) test-migrationwave + TIER3=1 $(MAKE) test-analysis # # Feature tests. diff --git a/analysis/tc_tackle_testapp_public.go b/analysis/tc_tackle_testapp_public.go deleted file mode 100644 index 6b83cf7..0000000 --- a/analysis/tc_tackle_testapp_public.go +++ /dev/null @@ -1,113 +0,0 @@ -package analysis - -import ( - "github.com/konveyor/go-konveyor-tests/hack/addon" - "github.com/konveyor/tackle2-hub/api" -) - -var TackleTestApp = api.Application{ - Name: "Tackle Testapp public", - Repository: &api.Repository{ - Kind: "git", - URL: "https://github.com/konveyor/tackle-testapp-public", - }, -} - -var TackleTestappPublic = TC{ - Name: "Tackle Testapp public", - Application: TackleTestApp, - Task: Analyze, - WithDeps: false, - Labels: addon.Labels{ - Included: []string{ - "konveyor.io/target=cloud-readiness", - "konveyor.io/target=linux", - }, - }, - Identities: []api.Identity{}, - Analysis: api.Analysis{ - Effort: 8, - Issues: []api.Issue{ - { - Category: "mandatory", - Description: "Hardcoded IP Address\nWhen migrating environments, hard-coded IP addresses may need to be modified or eliminated.", - Effort: 1, - RuleSet: "discovery-rules", - Rule: "hardcoded-ip-address", - Incidents: []api.Incident{ - { - File: "/shared/source/tackle-testapp-public/src/main/resources/persistence.properties", - Line: 2, - Message: "When migrating environments, hard-coded IP addresses may need to be modified or eliminated.", - CodeSnip: "jdbc.url=jdbc:oracle:thin:@10.19.2.93:15", - }, - }, - }, - { - Category: "mandatory", - Description: "File system - Java IO\nAn application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.", - Effort: 1, - RuleSet: "openshift", - Rule: "local-storage-00001", - Incidents: []api.Incident{ - { - File: "/shared/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java", - Line: 45, - Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.", - CodeSnip: "dataSource.setDriverClassName(config.getProperty(\"jdbc.driverClassName\"));", - }, - { - File: "/shared/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java", - Line: 46, - Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.", - CodeSnip: "dataSource.setUrl(config.getProperty(\"jdbc.url\"));", - }, - { - File: "/shared/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java", - Line: 47, - Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.", - CodeSnip: "dataSource.setUsername(config.getProperty(\"jdbc.user\"));", - }, - { - File: "/shared/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java", - Line: 48, - Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.", - CodeSnip: "dataSource.setPassword(config.getProperty(\"jdbc.password\"));", - }, - { - File: "/shared/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java", - Line: 56, - Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.", - CodeSnip: "transactionManager.setEntityManagerFactory(", - }, - { - File: "/shared/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java", - Line: 68, - Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.", - CodeSnip: "hibernateProperties.setProperty(\"hibernate.hbm2ddl.auto\", config.getProperty(\"hibernate.hbm2ddl.auto\"));", - }, - { - File: "/shared/source/tackle-testapp-public/src/main/java/io/konveyor/demo/ordermanagement/config/PersistenceConfig.java", - Line: 69, - Message: "An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.", - CodeSnip: "hibernateProperties.setProperty(\"hibernate.dialect\", config.getProperty(\"hibernate.dialect\"));", - }, - }, - }, - }, - }, - AnalysisTags: []api.Tag{ - {Name: "EJB XML", Category: api.Ref{Name: "Bean"}}, - {Name: "Servlet", Category: api.Ref{Name: "HTTP"}}, - {Name: "Properties", Category: api.Ref{Name: "Other"}}, - {Name: "Java EE Batch", Category: api.Ref{Name: "Processing"}}, - {Name: "Java EE Batch", Category: api.Ref{Name: "Java EE"}}, - {Name: "Servlet", Category: api.Ref{Name: "Java EE"}}, - {Name: "EJB XML", Category: api.Ref{Name: "Java EE"}}, - {Name: "Properties", Category: api.Ref{Name: "Sustain"}}, - {Name: "Properties", Category: api.Ref{Name: "Embedded"}}, - {Name: "Java EE Batch", Category: api.Ref{Name: "Execute"}}, - {Name: "EJB XML", Category: api.Ref{Name: "Connect"}}, - {Name: "Servlet", Category: api.Ref{Name: "Connect"}}, - }, -} diff --git a/analysis/tc_tackle_testapp_private_binary.go b/analysis/tc_tackle_testapp_public_binary.go similarity index 97% rename from analysis/tc_tackle_testapp_private_binary.go rename to analysis/tc_tackle_testapp_public_binary.go index 7ccf6dd..396047d 100644 --- a/analysis/tc_tackle_testapp_private_binary.go +++ b/analysis/tc_tackle_testapp_public_binary.go @@ -7,11 +7,11 @@ import ( "github.com/konveyor/tackle2-hub/api" ) -var TackleTestappPrivateBinary = TC{ +var TackleTestappPublicBinary = TC{ Name: "tackle-testapp-binary", - Application: data.TackleTestapp, + Application: data.TackleTestappPublic, Identities: []api.Identity{ - identity.TackleTestappMaven, + identity.MavenPublic, }, Task: Analyze, Labels: addon.Labels{ diff --git a/analysis/tc_tackle_testapp_public_deps.go b/analysis/tc_tackle_testapp_public_deps.go index 678f6f5..ad799c4 100644 --- a/analysis/tc_tackle_testapp_public_deps.go +++ b/analysis/tc_tackle_testapp_public_deps.go @@ -1,16 +1,15 @@ package analysis import ( + "github.com/konveyor/go-konveyor-tests/data" + "github.com/konveyor/go-konveyor-tests/data/identity" "github.com/konveyor/go-konveyor-tests/hack/addon" "github.com/konveyor/tackle2-hub/api" - "github.com/konveyor/tackle2-hub/test/api/identity" ) -var MavenPublic = identity.Mvn - var TackleTestappPublicWithDeps = TC{ Name: "Tackle Testapp public with deps", - Application: TackleTestApp, + Application: data.TackleTestappPublic, Task: Analyze, WithDeps: true, Labels: addon.Labels{ @@ -20,8 +19,7 @@ var TackleTestappPublicWithDeps = TC{ }, }, Identities: []api.Identity{ - MavenPublic, // Tackle Testapp public Maven registry expects MAVEN_TESTAPP_USER and MAVEN_TESTAPP_TOKEN env variables. - + identity.MavenPublic, }, Analysis: api.Analysis{ Effort: 2, diff --git a/analysis/tc_tackle_testapp_public_package_filter.go b/analysis/tc_tackle_testapp_public_package_filter.go index 875859d..22354ce 100644 --- a/analysis/tc_tackle_testapp_public_package_filter.go +++ b/analysis/tc_tackle_testapp_public_package_filter.go @@ -1,21 +1,14 @@ package analysis import ( + "github.com/konveyor/go-konveyor-tests/data" "github.com/konveyor/go-konveyor-tests/hack/addon" "github.com/konveyor/tackle2-hub/api" ) -var TackleTestAppPackageFilter = api.Application{ - Name: "Tackle Testapp public", - Repository: &api.Repository{ - Kind: "git", - URL: "https://github.com/konveyor/tackle-testapp-public", - }, -} - var TackleTestappPublicPackageFilter = TC{ Name: "Tackle Testapp public with package filter", - Application: TackleTestApp, + Application: data.TackleTestappPublic, Task: Analyze, WithDeps: false, Labels: addon.Labels{ diff --git a/analysis/test_cases.go b/analysis/test_cases.go index 640df5e..4277d17 100644 --- a/analysis/test_cases.go +++ b/analysis/test_cases.go @@ -7,6 +7,7 @@ var Tier0TestCases = []TC{ TackleTestappPublicPackageFilter, AcmeairWebapp, Tomcat, + TackleTestappPublicBinary, } // Tier 1 Analysis test cases - should work. @@ -19,7 +20,6 @@ var Tier1TestCases = []TC{ // List of applications with expected analysis outputs. var Tier2TestCases = []TC{ AdministracionEfectivo, - TackleTestappPublic, Daytrader, PetclinicHazelcast, ApacheWicket, @@ -29,5 +29,4 @@ var Tier2TestCases = []TC{ // Tier 3 Analysis with credentials test cases - should work // List of applications with expected analysis outputs. var Tier3TestCases = []TC{ - TackleTestappPrivateBinary, // Needs GITHUB_USER and GITHUB_TOKEN env variables with Read access to https://github.com/konveyor/tackle-testapp } diff --git a/data/application_data.go b/data/application.go similarity index 84% rename from data/application_data.go rename to data/application.go index 7687957..3c6844c 100644 --- a/data/application_data.go +++ b/data/application.go @@ -26,11 +26,11 @@ var ( URL: "https://github.com/ibraginsky/book-server", }, } - TackleTestapp = api.Application{ - Name: "tackle-testapp", + TackleTestappPublic = api.Application{ + Name: "Tackle Testapp public", Repository: &api.Repository{ - Kind: "subversion", - URL: "https://github.com/konveyor/tackle-testapp", + Kind: "git", + URL: "https://github.com/konveyor/tackle-testapp-public", }, Binary: "io.konveyor.demo:customers-tomcat:0.0.1-SNAPSHOT:war", } @@ -45,5 +45,5 @@ var ( Path: "example-1", }, } - ApplicationSamples = []api.Application{Minimal, PathfinderGit, BookServer, TackleTestapp, UploadBinary, CustomerTomcatLegacy} + ApplicationSamples = []api.Application{Minimal, PathfinderGit, BookServer, TackleTestappPublic, UploadBinary, CustomerTomcatLegacy} ) diff --git a/data/identity/identity_data.go b/data/identity/identity.go similarity index 76% rename from data/identity/identity_data.go rename to data/identity/identity.go index f724253..998a8aa 100644 --- a/data/identity/identity_data.go +++ b/data/identity/identity.go @@ -1,8 +1,16 @@ package identity -import "github.com/konveyor/tackle2-hub/api" +import ( + "github.com/konveyor/tackle2-hub/api" + "github.com/konveyor/tackle2-hub/test/api/identity" +) -var TackleTestappMaven = api.Identity{ +// Tackle Testapp public Maven registry expects MAVEN_TESTAPP_USER and MAVEN_TESTAPP_TOKEN env variables. +// For more information, see: https://github.com/konveyor/tackle-testapp-public?tab=readme-ov-file#building-the-application +var MavenPublic = identity.Mvn + + +var TackleTestappPrivateMaven = api.Identity{ Kind: "maven", Name: "maven-creds", Settings: ` diff --git a/go-konveyor-tests.config b/go-konveyor-tests.config index a37d880..482ca37 100644 --- a/go-konveyor-tests.config +++ b/go-konveyor-tests.config @@ -14,5 +14,3 @@ export JIRA_SERVER_PASSWORD="" export JIRA_SERVER_TOKEN="" # Enviroment variebles needed for Tier3 Analysis test -export GITHUB_USER="" -export GITHUB_TOKEN=""