2

I have a Gitlab pipeline which executes a maven build in a docker image (maven:3.5.2-jdk-8)

When I execute the command

- mvn $MAVEN_CLI_OPTS -P package_project -U  clean install -Dmaven.test.skip=true

I get a yarn error because Cypress cannot be downloaded:

[INFO] [4/4] Building fresh packages...
[INFO] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[ERROR] error /builds/custom/project-parent/project_front/project/node_modules/cypress: Command failed.
[ERROR] Exit code: 1
[ERROR] Command: node index.js --exec install
[ERROR] Arguments: 
[ERROR] Directory: /builds/custom/project-parent/project_front/project/node_modules/cypress
[ERROR] Output:
[ERROR] Installing Cypress (version: 5.3.0)
[ERROR] 
[ERROR] [14:11:05]  Downloading Cypress     [started]
[ERROR] [14:13:14]  Downloading Cypress     [failed]
[ERROR] The Cypress App could not be downloaded.
[ERROR] 
[ERROR] Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration
[ERROR] 
[ERROR] Otherwise, please check network connectivity and try again:
[ERROR] 
[ERROR] ----------
[ERROR] 
[ERROR] URL: https://download.cypress.io/desktop/5.3.0?platform=linux&arch=x64
[ERROR] Error: connect ETIMEDOUT 172.67.69.12:443
[ERROR] 
[ERROR] ----------
[ERROR] 
[ERROR] Platform: linux (Debian - 9.3)
[ERROR] Cypress Version: 5.3.0
[ERROR] 

I use the frontend-maven-plugin with Yarn. This is the declaration in the pom.xml

<plugin>
    <groupId>com.github.eirslett</groupId>
    <artifactId>frontend-maven-plugin</artifactId>
    <version>${frontend-maven-plugin.version}</version>
    <configuration>
        <nodeVersion>${node.version}</nodeVersion>
        <yarnVersion>${yarn.version}</yarnVersion>
        <workingDirectory>${frontend-src-dir}</workingDirectory>
        <installDirectory>${project.build.directory}</installDirectory>
    </configuration>
    <executions>
        <execution>
            <id>install-frontend-tools</id>
            <goals>
                <goal>install-node-and-yarn</goal>
            </goals>
        </execution>
        <execution>
            <id>yarn-install</id>
            <goals>
                <goal>yarn</goal>
            </goals>
            <configuration>
                <!-- Le proxy maven n'est pas utilisé, on le redéfinit-->
                <yarnInheritsProxyConfigFromMaven>true</yarnInheritsProxyConfigFromMaven>
                <arguments>install</arguments>
            </configuration>
        </execution>
        <execution>
            <id>build-frontend</id>
            <goals>
                <goal>yarn</goal>
            </goals>
            <phase>prepare-package</phase>
            <configuration>
                <arguments>build</arguments>
            </configuration>
        </execution>
    </executions>
</plugin>

The docker container can access the internet because I use en apt-get command which works

The proxy of my organisation is declared in the maven settings:

<proxies>
    <proxy>
        <id>myOrganization</id>
        <active>true</active>
        <protocol>http</protocol>
        <host>city.proxy.corp.myOrganization</host>
        <port>8080</port>
    </proxy>
    <proxy>
        <id>myOrganizationSecure</id>
        <active>true</active>
        <protocol>https</protocol>
        <host>city.proxy.corp.myOrganization</host>
        <port>8080</port>
    </proxy>
</proxies>

Theses informations are visible ine the log of the plugin :

[INFO] --- frontend-maven-plugin:1.7.6:yarn (yarn-install) @ project_front ---
[INFO] Found proxies: [myOrganization{protocol='http', host='city.proxy.corp.myOrganization', port=8080}, myOrganizationSecure{protocol='https', host='city.proxy.corp.myOrganization', port=8080}]
[INFO] Running 'yarn install --https-proxy=city.proxy.corp.myOrganization:8080 --proxy=city.proxy.corp.myOrganization:8080' in /builds/custom/project-parent/project/project-src

When I test this goal to confirm the proxy configuration, the proxy is not return by config-list :

<execution>
    <id>yarn-config</id>
    <goals>
        <goal>yarn</goal>
    </goals>
    <configuration>
        <yarnInheritsProxyConfigFromMaven>true</yarnInheritsProxyConfigFromMaven>
        <arguments>config list</arguments>
    </configuration>
</execution>

[INFO] --- frontend-maven-plugin:1.7.6:yarn (yarn-config) @ project_front ---
[INFO] Found proxies: [myOrganization{protocol='http', host='city.proxy.corp.myOrganization', port=8080}, myOrganizationSecure{protocol='https', host='city.proxy.corp.myOrganization', port=8080}]
[INFO] Running 'yarn config list --https-proxy=http://city.proxy.corp.myOrganization --proxy=http://city.proxy.corp.myOrganization' in /builds/project/project-parent/project_front/project
[INFO] yarn config v1.15.2
[INFO] info yarn config
[INFO] { 'version-tag-prefix':
[INFO]    'v',
[INFO]   'version-git-tag':
[INFO]    true,
[INFO]   'version-commit-hooks':
[INFO]    true,
[INFO]   'version-git-sign':
[INFO]    false,
[INFO]   'version-git-message':
[INFO]    'v%s',
[INFO]   'init-version':
[INFO]    '1.0.0',
[INFO]   'init-license':
[INFO]    'MIT',
[INFO]   'save-prefix':
[INFO]    '^',
[INFO]   'bin-links':
[INFO]    true,
[INFO]   'ignore-scripts':
[INFO]    false,
[INFO]   'ignore-optional':
[INFO]    false,
[INFO]   registry:
[INFO]    'https://registry.yarnpkg.com',
[INFO]   'strict-ssl':
[INFO]    true,
[INFO]   'user-agent':
[INFO]    'yarn/1.15.2 npm/? node/v10.15.3 linux x64' }
[INFO] info npm config
[INFO] {}
[INFO] Done in 0.04s.
[INFO] 

Do you know why yarn in the plugin can't access the internet for downloading Cypress ?

danielnelz
  • 3,794
  • 4
  • 25
  • 35
Broshet
  • 133
  • 12
  • Did you get it resolved? I am also facing the same issue. – Ansuman Oct 28 '20 at 09:18
  • I resolved it by setting the proxy in the Jenkins global configuration as the post install script (Required to download cypress) does not get the proxy settings from Maven. There is an open Github issue for 'frontend-maven-plugin' – Ansuman Oct 28 '20 at 09:58
  • Hello I could not continue on this subject due to the major technical constraint. I will resume this work in the days or weeks to come. I see you managed to bypass this problem on Jenkins, however, in my case I am using GITLAB CI / CD in Docker mode. I understand this means that the frontend-maven-plugin does not take proxy from maven despite tag? What is the open ticker on Github that mentions this? Thank you for your help ;-) – Broshet Oct 28 '20 at 13:13

0 Answers0