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

--creation-source not supported by selfhosted version #71

Open
jemand771 opened this issue Apr 9, 2023 · 4 comments
Open

--creation-source not supported by selfhosted version #71

jemand771 opened this issue Apr 9, 2023 · 4 comments

Comments

@jemand771
Copy link

Hi there,

I'm just getting started with uffizzi so sorry in advance if I missed something obvious.

I'm using a selfhosted install of uffizzi, although not using the official helm chart for bogus personal reasons1.
Creating manual preview environments via uffizzi preview create docker-compose.yaml works, so the server setup itself feels okay.
However, using the github action based on this repo's readme like this...

  deploy-uffizzi-preview:
    name: Use Remote Workflow to Preview on Uffizzi
    needs: render-compose-file
    uses: jemand771/preview-action/.github/workflows/reusable.yaml@no-creation-source
    with:
      compose-file-cache-key: ${{ needs.render-compose-file.outputs.compose-file-cache-key }}
      compose-file-cache-path: ${{ needs.render-compose-file.outputs.compose-file-cache-path }}
      server: https://my-uffizzi-host.example.com
      username: some-user
      project: test-project
    secrets:
      password: ${{ secrets.uffizzi_pass }}
    permissions:
      contents: read
      pull-requests: write
      id-token: write

...results in an error. I've tried to investigate it but got stuck unsure if I'm doing something wrong or if this is just broken.

starting with #55, --creation-source=github_actions gets passed to the CLI here:

preview-action/action.yaml

Lines 102 to 107 in bae8176

args:
- 'preview'
- 'create'
- '--set-labels=github.ref=${{ inputs.github-ref }} github.repository=${{ inputs.github-repository }} github.event.number=${{ inputs.github-event-number }}'
- '--creation-source=github_actions'
- ${{ inputs.compose-file }}

This is part of the v2 branch which people are supposed to use according to the readme:

preview-action/README.md

Lines 78 to 90 in bae8176

deploy-uffizzi-preview:
name: Use Remote Workflow to Preview on Uffizzi
needs: render-compose-file
uses: UffizziCloud/preview-action/.github/workflows/reusable.yaml@v2
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
with:
compose-file-cache-key: ${{ needs.render-compose-file.outputs.compose-file-cache-key }}
compose-file-cache-path: ${{ needs.render-compose-file.outputs.compose-file-cache-path }}
server: https://app.uffizzi.com/
permissions:
contents: read
pull-requests: write
id-token: write

However, the server doesn't seem to support that. I'm getting this error...

Server Error:
is not included in the list

...which I'm assuming comes from here:
https://github.com/UffizziCloud/uffizzi/blob/a4b1356695c5e89f905585c649ee07ca33c4489f/core/app/lib/uffizzi_core/concerns/models/deployment.rb#L30

    enumerize :creation_source, in: [:manual, :demo, :continuous_preview, :compose_file_manual, :compose_file_continuous_preview],
                                predicates: true, scope: true, default: :manual

This was actually almost implemented in UffizziCloud/uffizzi#346, UffizziCloud/uffizzi@1204d83#diff-7eaf3aeada9f27cbf1c93ca78682ca4bda47e215fb0f2c941e6b38a31ff4e346R30 to be precise...

- enumerize :creation_source, in: [:manual, :continuous_preview, :compose_file_manual, :compose_file_continuous_preview],
+ enumerize :creation_source, in: [:manual, :continuous_preview, :compose_file_manual, :compose_file_continuous_preview, :github_actions],

...but got reverted in UffizziCloud/uffizzi@9be671c after UffizziCloud/uffizzi#346 (comment)

Now, it's possible that I'm just unlucky and caught this feature mid-development where one side is already updated but the other one hasn't been adjusted yet. But since this was in january and the change has been explicitly declined, I'm afraid this is "working" as intended. (just not for me)

I see a couple of possible solutions here:

  1. pass a different --creation-source
  2. support :github_actions in https://github.com/UffizziCloud/uffizzib)
  3. add an option that lets users specify a creation source, defaulting to the saas-supported one
  4. automatically detect whether a selfhosted server url is passed and if so, pass a different creation source

This might be related to UffizziCloud/uffizzi#230, but I don't really have a full picture there (again, new to uffizzi). It's worth noting that the preview URL posted by github actions is in the format example.com/github.com/REPO_OWNER/REPO_NAME/pull/NUMBER while the actual preview url as returned by the server and posted to the github deployment status is deployment-INDEX-PROJECT_NAME.example.com. (index unrelated to pr number)

Again, that might be a separate issue but feels related anyway.

Again, sorry if this is just an issue with how I'm using the action. If it turns out that this is a bug, let me know if you need me to test anything; I'd be happy to help.

Footnotes

  1. Here's (probably) irrelevant context about my setup that I still wanted to share: uffizzi feels like it's designed to run on its own standalone cluster, seeing how it comes with cert-manager and an ingress controller that can't be disabled. Because this is just for my personal/hobby setup, I tried integrating it into my existing cluster which already has cert-manager, a clusterissuer with dns-01 support and traefik as an ingress controller. I kinda copy-pasted together all of the env variables for the controller, web and sidekiq deployments, and everything seems to work together. The only hack I still have to do is manually removing the ingress class annotation for every deployment created by uffizzi. I'll probably either create an automated hack for this or submit an issue about making the annotation configurable to the controller repo.

@jpthurman
Copy link
Member

Thanks @jemand771 - we'll take a look at this soon. Hopefully Monday

@moklidia
Copy link
Collaborator

@jemand771 Please update the uffizzi/core to the latest version (v2.1.18) and try again

@jemand771
Copy link
Author

Huh, I'm not even using uffizzi/core anywhere, just /app and /controller. Updating those seems to fix the issue, thanks!
I don't see a readme on dockerhub, what does the core image do? and while we're here: do the uffizzi/app and uffizzi/controller images really not have version tags? Just pulling :latest and relying on imagePullPolicy: Always feels really hacky and could cause unexpected updates in the future.

The server still creates the ingress as deployment-XXX-test-project.preview.example.com instead of the preview.example.com/github.com/REPO_OWNER/REPO_NAME/pull/YYY linked in the comment. Is that intentional?
This might just be due to the selfhosted version not having a dashboard, so all requests to preview.example.com just result in rails error pages either way. In general, the comment left by the action is pretty useless for selfhosted since the "application logs" link doesn't lead anywhere either.

@axisofentropy
Copy link
Member

The server still creates the ingress as deployment-XXX-test-project.preview.example.com instead of the preview.example.com/github.com/REPO_OWNER/REPO_NAME/pull/YYY linked in the comment. Is that intentional? This might just be due to the selfhosted version not having a dashboard, so all requests to preview.example.com just result in rails error pages either way. In general, the comment left by the action is pretty useless for selfhosted since the "application logs" link doesn't lead anywhere either.

These "predictable URL's" are a feature of our hosted platform so they may not work for open-source Uffizzi. It looks like the URL comes back from the API so we can look at changing that behavior.

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

No branches or pull requests

4 participants