Skip to content

Commit 9d59969

Browse files
authored
Merge pull request #2652 from github/mbg/private-registries/feed-outputs
Add private registry URLs as output to the `start-proxy` Action
2 parents dd75594 + 38fd34c commit 9d59969

File tree

7 files changed

+118
-1
lines changed

7 files changed

+118
-1
lines changed

.github/workflows/__start-proxy.yml

Lines changed: 80 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/start-proxy-action.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/start-proxy-action.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
env

pr-checks/checks/start-proxy.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Start proxy"
2+
description: "Tests that the proxy can be initialised on all platforms"
3+
operatingSystems: ["ubuntu", "macos", "windows"]
4+
versions: ["linked"]
5+
steps:
6+
- uses: ./../action/init
7+
with:
8+
languages: csharp
9+
tools: ${{ steps.prepare-test.outputs.tools-url }}
10+
11+
- name: Setup proxy for registries
12+
id: proxy
13+
uses: ./../action/start-proxy
14+
with:
15+
registry_secrets: '[{ "type": "nuget_feed", "url": "https://api.nuget.org/v3/index.json" }]'
16+
17+
- name: Print proxy outputs
18+
run: |
19+
echo "${{ steps.proxy.outputs.proxy_host }}"
20+
echo "${{ steps.proxy.outputs.proxy_port }}"
21+
echo "${{ steps.proxy.outputs.proxy_urls }}"
22+
23+
- name: Fail if proxy outputs are not set
24+
if: (!steps.proxy.outputs.proxy_host) || (!steps.proxy.outputs.proxy_port) || (!steps.proxy.outputs.proxy_ca_certificate) || (!steps.proxy.outputs.proxy_urls)
25+
run: exit 1

src/start-proxy-action.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ async function startProxy(
171171
core.setOutput("proxy_host", host);
172172
core.setOutput("proxy_port", port.toString());
173173
core.setOutput("proxy_ca_certificate", config.ca.cert);
174+
175+
const registry_urls = config.all_credentials
176+
.filter((credential) => credential.url !== undefined)
177+
.map((credential) => credential.url);
178+
core.setOutput("proxy_urls", JSON.stringify(registry_urls));
174179
} catch (error) {
175180
core.setFailed(`start-proxy action failed: ${util.getErrorMessage(error)}`);
176181
}

start-proxy/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ outputs:
2323
description: The port of the proxy
2424
proxy_ca_certificate:
2525
description: The proxy's internal CA certificate in PEM format
26+
proxy_urls:
27+
description: The URLs of the configured registries, as a JSON array.
2628
runs:
2729
using: node20
2830
main: "../lib/start-proxy-action.js"

0 commit comments

Comments
 (0)