CircleCI-Public / orb-tools-orb

Various tools for authoring and publishing CircleCI orbs
https://circleci.com/orbs/registry/orb/circleci/orb-tools
MIT License
51 stars 74 forks source link

feat: support for CircleCI Server #156

Closed rprince-anduril closed 2 years ago

rprince-anduril commented 2 years ago

support self-hosted CCI server in orb-tools/publish

orb-publisher commented 2 years ago

Your development orb has been published. It will expire in 30 days. You can preview what this will look like on the CircleCI Orb Registry at the following link: https://circleci.com/developer/orbs/orb/circleci/orb-tools?version=dev:edd2e1063d38f92aa220717b9ed9750889a061d8

KyleTryon commented 2 years ago

@rprince-anduril could I actually ask one small favor. Could we remove :-https://circleci.com. the reason is, this will never be triggered. The default value is set by the orb itself, so CIRCLE_API_HOST will always have a value, and that value by default is still https://circleci.com

rprince-anduril commented 2 years ago

@KyleTryon Also added a fix for pr comments to support GitHub Enterprise servers by adding a paramter to orb-tools/publish for pr-comment-graphql-url

Tested the resulting curl calls with:

$ curl --request POST -s --url 'https://ghe.anduril.dev/api/graphql?=' --header "Authorization: Bearer $GITHUB_TOKEN" --data '{"query":"query IsAuthenticated {\n  viewer {\n    login\n  }\n}","variables":{},"operationName":"IsAuthenticated"}'
{"data":{"viewer":{"login":"rprince"}}}
rprince-anduril commented 2 years ago

One more issue in orb-tools/pack in the Validating orb step:

#!/bin/bash -eo pipefail
#!/bin/bash
circleci orb validate --skip-update-check "${ORB_PARAM_OUTPUT_DIR}orb.yml"

Error: Cannot find devinfra/shallow-clone-orb@0.1.0 in the orb registry. Check that the namespace, orb name and version are correct.

Exited with code exit status 255

CircleCI received exit code 255

pushed another circleci --host --token fix to the script

orb-publisher commented 2 years ago

Your development orb has been published. It will expire in 30 days. You can preview what this will look like on the CircleCI Orb Registry at the following link: https://circleci.com/developer/orbs/orb/circleci/orb-tools?version=dev:2cecc8014f77c89d6b3cdcf69c738099b489a5d3

rprince-anduril commented 2 years ago

Looks like test-deploy.yml doesn't have CIRCLE_API_HOST set. Not sure if you set that in the project or need to add a context.

KyleTryon commented 2 years ago

Looks like test-deploy.yml doesn't have CIRCLE_API_HOST set. Not sure if you set that in the project or need to add a context.

Like CIRCLE_API_HOST, because we need to account for how this is being called within the orb directly, we would need to make this parametrizable with a default value.

kelvintaywl commented 2 years ago

@KyleTryon and @rprince-anduril

thanks for the conversations and work here.

As per Kyle's comments, I made a PR #161 to address this on behalf of @rprince-anduril here 🤝

Apologies, as I have to make a PR against a PR here. since these are all from forked repos (iiuc).

If we can merge #161 into this #156, and then re-trigger the builds, I believe the tests should pass now 👍

KyleTryon commented 2 years ago

Closed by #161