github icon indicating copy to clipboard operation
github copied to clipboard

http proxy is not working on Openshift

Open USI-KMD opened this issue 2 years ago • 9 comments

Creating GitHub release is failing when semantic-release is executed on an Openshift behind a corporate proxy. When working on an Openshift clusters without a proxy the same configuration works fine. Also, the corporate proxy works fine in all other cases.

I tried configuring the proxy using HTTP_PROXY and HTTPS_PROXY environment variables and via the following .releaserc config:

{
  "branches": [
    "+([0-9])?(.{+([0-9]),x}).x",
    {
      "name": "main",
      "prerelease": false
    }
  ],
  "plugins": [
    [
      "@semantic-release/commit-analyzer",
      {
        "preset": "angular"
      }
    ],
    "@semantic-release/changelog",
    [
      "@semantic-release/github",
      {
        "proxy": {
          "host": "XXXXX [redacted]",
          "port": 3128,
          "secureProxy": false
        }
      }
    ]
  ]
}

However, in all cases I'm getting the following error:

2023-09-11T12:53:48.405Z semantic-release:get-git-auth-url Verifying ssh auth by attempting to push to  https://git:[secure]@github.com/XXXXX.git
2023-09-11T12:53:51.494Z semantic-release:get-tags found tags for branch main: []
2023-09-11T12:53:51.503Z semantic-release:get-tags found tags for branch test-sem-ver-proxy: []
[12:53:51 PM] [semantic-release] › ✔  Run automated release from branch test-sem-ver-proxy on repository https://git:[secure]@github.com/XXXXXX.git
[12:53:51 PM] [semantic-release] › ✔  Allowed to push to the Git repository
[12:53:51 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/exec"
[12:53:51 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/exec"
[12:53:51 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/changelog"
[12:53:51 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/changelog"
[12:53:51 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
[12:53:51 PM] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication
[12:54:46 PM] [semantic-release] › ✘  Failed step "verifyConditions" of plugin "@semantic-release/github"
[12:54:46 PM] [semantic-release] › ✘  An error occurred while running semantic-release: RequestError [HttpError]: fetch failed
    at /usr/local/lib/node_modules/@semantic-release/github/node_modules/@octokit/request/dist-node/index.js:136:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async requestWithGraphqlErrorHandling (/usr/local/lib/node_modules/@semantic-release/github/node_modules/@octokit/plugin-retry/dist-node/index.js:71:20)
    at async Job.doExecute (/usr/local/lib/node_modules/@semantic-release/github/node_modules/bottleneck/light.js:405:18) {
  status: 500,
  request: {
    method: 'GET',
    url: 'https://api.github.com/repos/XXXXXX',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': '@semantic-release/github v9.0.5 octokit-core.js/5.0.0 Node.js/18.17.1 (linux; x64)',
      authorization: 'token [REDACTED]'
    },
    request: {
      agent: [HttpsProxyAgent],
      hook: [Function: bound bound register],
      retryCount: 3,
      retries: 3,
      retryAfter: 16
    }
  },
  pluginName: '@semantic-release/github'
}
AggregateError: 
    HttpError: fetch failed
        at /usr/local/lib/node_modules/@semantic-release/github/node_modules/@octokit/request/dist-node/index.js:136:11
        at async requestWithGraphqlErrorHandling (/usr/local/lib/node_modules/@semantic-release/github/node_modules/@octokit/plugin-retry/dist-node/index.js:71:20)
        at async Job.doExecute (/usr/local/lib/node_modules/@semantic-release/github/node_modules/bottleneck/light.js:405:18)
    at file:///usr/local/lib/node_modules/[4msemantic-release[24m/lib/plugins/pipeline.js:55:13
    at async pluginsConfigAccumulator.<computed> [as verifyConditions] (file:///usr/local/lib/node_modules/[4msemantic-release[24m/lib/plugins/index.js:87:11)
    at async run (file:///usr/local/lib/node_modules/[4msemantic-release[24m/index.js:106:3)
    at async Module.default (file:///usr/local/lib/node_modules/[4msemantic-release[24m/index.js:275:22)
    at async default (file:///usr/local/lib/node_modules/[4msemantic-release[24m/cli.js:55:5) {
  errors: [
    RequestError [HttpError]: fetch failed
        at /usr/local/lib/node_modules/[4m@semantic-release[24m/github/node_modules/[4m@octokit[24m/request/dist-node/index.js:136:11
    [90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)[39m
        at async requestWithGraphqlErrorHandling (/usr/local/lib/node_modules/[4m@semantic-release[24m/github/node_modules/[4m@octokit[24m/plugin-retry/dist-node/index.js:71:20)
        at async Job.doExecute (/usr/local/lib/node_modules/[4m@semantic-release[24m/github/node_modules/[4mbottleneck[24m/light.js:405:18) {
      status: [33m500[39m,
      request: [36m[Object][39m,
      pluginName: [32m'@semantic-release/github'[39m
    }
  ]
}

Is there an error in my configuration? Otherwise, I would greatly appreciate any help with further troubleshooting.

USI-KMD avatar Sep 11 '23 13:09 USI-KMD

@USI-KMD Have you figured it out. Dealing with similar issue.

UDWSU1 avatar Nov 01 '23 19:11 UDWSU1

open to a PR to improve documentation or suggestion for a fix if there is a problem with the current implementation, but could use help investigating this. i have no environment to test this scenario from. if someone could provide a public reproduction, that could be a place to start

travi avatar Nov 03 '23 18:11 travi

I also am finding that proxy settings are not respected. I can reproduce locally while on/off our corporate VPN.

I dont know how to set up a proxy quickly but the easiest way to tell there is an issue is by setting the proxy environment variables to random values and see that it still works which it shouldnt.

export HTTPS_PROXY=http://internet.x.com:4444
export HTTP_PROXY=http://internet.x.com:4444
npm config set proxy http://internet.x.com:4444
npm config set https-proxy http://internet.x.com:4444

This url is fake so we should expect semantic release to fail but yet it works

channon4 avatar Nov 15 '23 17:11 channon4

likely related: https://github.com/octokit/request.js/issues/577

travi avatar Dec 06 '23 04:12 travi

I also have the same mistake, proxy IP is an internal network

dashuaige2000 avatar Jul 09 '24 21:07 dashuaige2000

Facing same issues, have you found a solution?

vmorales-2920 avatar Aug 20 '24 20:08 vmorales-2920