Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capability to pass Host/Port config when running gradle task "allureServe" #57

Closed
2 tasks
RamiaSaidawi opened this issue Nov 27, 2020 · 9 comments
Closed
2 tasks

Comments

@RamiaSaidawi
Copy link

RamiaSaidawi commented Nov 27, 2020

I'm submitting a ...

  • bug report
  • [Yes ] feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

When running "gradle allureServe" i cannot specify what host/port i want the reports to be served on.
running Allure command line "allure serve" give the ability to specify host/port if needed
$> allure serve -h 127.0.0.1 -p 3030

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

What is the expected behavior?

i expect for gradle task "allureServe" to have same flexibility as "serve" command line
so i can setup host/port as part of the configuration

What is the motivation / use case for changing the behavior?

for data privacy we cannot use the tool if it upload results to hosts outside our domain

Please tell us about your environment:

Allure version 2.13.6
Test framework junit@4.13.1
Allure adaptor allure-junit4@2.13.6
Generate report using allure-gradle@2.18

Other information

this is what i think can be a fast fix, based on my limited knowledge of the code

_//## **in class AllureExtension :**_ 
_//## add properties so we can set as part of allure configuration_
String host
Int port
 

_//##  **in  class AllureServe extends DefaultTask**_
_//## add extra parameters_
@Input
    String host
@Input
    int port

void configureDefaults() {
        AllureExtension allureExtension = project.extensions.findByType(AllureExtension)
        if (Objects.nonNull(extensions)) {
            resultsDirs.add(allureExtension.resultsDir)
            version = allureExtension.version
            _//## read the host/port values_ 
            port = allureExtension.port
            host = allureExtension.host
        }
    }
)

_//## add  " -p port -h host"  to  "SERVE_COMMAND"_ 
_//## make sure port/host stay optional so projects dont care to change them still work_
project.exec {
            commandLine("$allureExecutable")
            args(SERVE_COMMAND)
            resultsDirs.each {
                copyCategoriesInfo(it, project)
                copyExecutorInfo(it, project)
                args("$it.absolutePath")
            }
        }

@vlsi
Copy link
Contributor

vlsi commented Apr 27, 2021

This PR adds --host and --port parameters to allureServe and allureAggregateServe tasks: #61

Please feel free to try it and provide feedback

@pandoras-toolbox
Copy link

How to use it with Gradle? This does not work: ./gradlew allureServe --host localhost

Unknown command-line option '--host'.

The problem is that the IP address which Allure serve picks is wrong on the developer MacBooks of some colleges. Why? I have no idea. But with "localhost" for the host it works. How can we configure that Allure serve uses "localhost" instead of any other IP address which does not work on some computers?

@vlsi
Copy link
Contributor

vlsi commented Oct 8, 2021

Which plugin version do you use?

@pandoras-toolbox
Copy link

The version of io.qameta.allure is 2.8.1. We are still using Gradle 6.9, I think newer plugin versions require at least Gradle 7.

@vlsi
Copy link
Contributor

vlsi commented Oct 8, 2021

Please upgrade.

https://github.com/allure-framework/allure-gradle#basic-usage

Note: 2.9+ requires Gradle 5.0+

@pandoras-toolbox
Copy link

I upgraded the Allure plugin to 2.9.4, the option --host now can be used, thank you. But in IntelliJ it does not display anymore the Gradle tasks "allureReport" and "allureServe". If I want them back I have to add the tasks myself in our project I guess.

@vlsi
Copy link
Contributor

vlsi commented Oct 8, 2021

Please check "verification" task group, the tasks should be there.

@pandoras-toolbox
Copy link

Oh, yeah, thank you again!

@RamiaSaidawi
Copy link
Author

RamiaSaidawi commented Nov 7, 2021

I updated to 2.9.6 and was able to run allureServe with specific host

created this task
task('localAllureServe', type: Exec, group: 'verification') {
executable './gradlew'
args 'allureServe', '--host', 'localhost'
}

thank you

@vlsi vlsi closed this as completed Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants