protected function getSnapshotUrl(string $path): string
    {
        if (getenv('JENKINS_URL') && getenv('BUILD_URL') && getenv('WORKSPACE')) {
            $realPath = realpath($path);
            if ($realPath) {
                // from absolute path, remove workspace
                $path = str_replace(getenv('WORKSPACE'), '', $realPath);
                // prepend url to artifact
                $path = getenv('BUILD_URL') . 'artifact' . DIRECTORY_SEPARATOR . $path;
            }
        }

        return $path;
    }
protected function getSnapshotUrl(string $path): string
    {
        if (getenv('JENKINS_URL') && getenv('BUILD_URL') && getenv('WORKSPACE')) {
            $realPath = realpath($path);
            if ($realPath) {
                // from absolute path, remove workspace
                $path = str_replace(getenv('WORKSPACE'), '', $realPath);
                // prepend url to artifact
                $path = getenv('BUILD_URL') . 'artifact' . DIRECTORY_SEPARATOR . $path;
            }
        }

        return $path;
    }
protected function getSnapshotUrl ( string $ path ) : string { if ( getenv ( 'JENKINS_URL' ) && getenv ( 'BUILD_URL' ) && getenv ( 'WORKSPACE' ) ) { $ realPath = realpath ( $ path ) ; if ( $ realPath ) { // from absolute path, remove workspace $ path = str_replace ( getenv ( 'WORKSPACE' ) , '' , $ realPath ) ; // prepend url to artifact $ path = getenv ( 'BUILD_URL' ) . 'artifact' . DIRECTORY_SEPARATOR . $ path ; } } return $ path ; }
Get url based on relative path of specific snapshot.
In our implementation we prepend artifact's URL to given relative path to make it clickable in Jenkins output.
Get url based on relative path of specific snapshot . In our implementation we prepend artifact s URL to given relative path to make it clickable in Jenkins output .