Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and use go only #60

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Refactor and use go only #60

wants to merge 9 commits into from

Conversation

hoshsadiq
Copy link

This PR refactors the whole repo and uses go only (where previously it was using bash, go, and ruby). This also adds an extra option to customise the comment that the bot leaves on a PR, which was the main reason I started making changes to the repo.

I've also set it up in a way where it should be easy to add support for additional CI environments.

action.yml Outdated
Comment on lines 34 to 39
- --timeout=${{ inputs.timeout }}
- --scope=${{ inputs.scope }}
- --variables=${{ inputs.variables }}
- --file=${{ inputs.file }}
- --branch=${{ inputs.branch }}
- --log-level=${{ inputs.log-level }}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does need some testing. I haven't checked what the implications are if the inputs are not set. I imagine an empty value will be sent through, which means the final result will not be the default set in the go code.

go.mod Outdated

require golang.org/x/text v0.16.0

require github.com/hoshsadiq/godotenv v1.0.0 // indirect
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used my custom fork of https://github.com/joho/godotenv/ which parses things a lot better. But happy to switch it back to https://github.com/joho/godotenv/, or another one if you have a preference.

Comment on lines +60 to +64
if [ ! -z "$OKTETO_CA_CERT" ]; then
echo "Custom certificate is provided"
echo "$OKTETO_CA_CERT" > /usr/local/share/ca-certificates/okteto_ca_cert.crt
update-ca-certificates
fi
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure where this is used, so haven't made the relevant changes yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to support the scenario where Okteto is using a private CA or a self-signed certificate

"PreviewURLSuffix": previewURLSuffix,
"PreviewSuccess": previewSucceeded,
"Endpoints": endpoints,
"EndpointsMap": getEndpointsMap(previewURLSuffix, endpoints),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useful in cases like this:

### :rocket: [Open MyApp]({{ index .EndpointsMap "app" }}) :rocket:

Supporting services are available at the following links:
- [Minio]({{ index .EndpointsMap "minio" }}) - the minio s3 emulator.
- [Database UI]({{ index .EndpointsMap "adminer" }}) - Database editor.

Which would translate to something like this:

🚀 Open MyApp 🚀

Supporting services are available at the following links:

@hoshsadiq hoshsadiq deleted the branch okteto:main August 4, 2024 22:50
@hoshsadiq hoshsadiq closed this Aug 4, 2024
@hoshsadiq hoshsadiq deleted the main branch August 4, 2024 22:50
@hoshsadiq hoshsadiq restored the main branch August 4, 2024 22:50
@hoshsadiq hoshsadiq reopened this Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants