qaprosoft / qps-pipeline

Jenkins pipeline and jobdsl scripts
11 stars 15 forks source link

be able to compile gradle project without gradlew inside the repo #867

Closed vdelendik closed 4 years ago

vdelendik commented 4 years ago

We have gradle tool enabled by default. it should be used if no gradlew wrapper in the repo

vdelendik commented 4 years ago
+ ./gradlew clean /home/.../onPush-..._tmp/durable-04da73ba/script.sh: 1: /home/jenkins/agent/workspace/..._tmp/durable-04da73ba/script.sh: ./gradlew: not found
vdelendik commented 4 years ago

it should be fixed in 5.2 @sandinosanchez, please provide test steps

sandinosanchez commented 4 years ago

feature delivered in #869

Environment:

infra-branch: develop

Objective:

Verify that the execution of gradle builds works with gradlew from the repository and gradle embedded tool from the infra.

Pre-conditions:

  1. Follow the steps(./zebrunner.sh stop if you have a running instance): 1.1. cd jenkins 1.2. nano .env 1.3. change TAG_JENKINS_SLAVE=latest-alpine > TAG_JENKINS_SLAVE=latest-alpine-jdk11 1.4. cd .. && ./zebrunner.sh start

  2. Go to jenkins > Manage jenkins > Global Properties > Add the following params: 2.1. GITHUB_HOST = gitlab.com 2.2. GITHUB_ORGANIZATION = sandino320 2.3. GITHUB_API_URL = https://gitlab/api/v4 2.4. GITHUB_HTML_URL = https://gitlab.com/sandino320/iam-service

  3. Run RegistterOrganization with orgName = sandino320

  4. Run RegisterRepository with:

    • runnerClass = com.qaprosoft.jenkins.pipeline.runner.gradle.Runner
    • scmHost = gitlab.com
    • repo = iam-service

Test scenario 1:

  1. run onPushJob with branch = master

Test scenario 2:

  1. run onPushJob with branch = develop

Expected results:

Test Scenario 1:

  1. onPushJob executed successfully. On the onPush logs look for the following:
    
    [INFO] gradleBuild->call
    [Pipeline] fileExists
    [Pipeline] tool
    Unpacking https://services.gradle.org/distributions/gradle-6.3-bin.zip to /opt/jenkins/tools/hudson.plugins.gradle.GradleInstallation/G6 on jenkins-slave
    [Pipeline] isUnix
    [Pipeline] withGradle
    [Pipeline] {
    [Pipeline] sh
    + /opt/jenkins/tools/hudson.plugins.gradle.GradleInstallation/G6/bin/gradle clean '-Dsonar.host.url=http://54.197.68.167:80/sonarqube' '-Dsonar.log.level=INFO' '-Dsonar.projectVersion=1' '-Dsonar.branch.name=master' sonarqube

Welcome to Gradle 6.3!

**Test Scenario 2:**
 1. onPushJob executed successfully. On the onPush logs look for the following:

[INFO] gradleBuild->call [Pipeline] fileExists [Pipeline] isUnix [Pipeline] withGradle [Pipeline] { [Pipeline] sh

P.S: recommend to run git stash after testing for removing the changes made in step 1.3 of the pre-conditions to avoid any conflicts when pulling

dhreben commented 4 years ago

Fixed: Environment:

Test Scenario 1:

Used onPushJob with branch = master onPushJob executed successfully

Screen Shot 2020-08-19 at 23 02 26

Test Scenario 2:

Used onPushJob with branch = develop onPushJob executed successfully.

Screen Shot 2020-08-19 at 23 13 36