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

How to deploy functions automatically in CI? #2278

Closed
drriguz opened this issue Apr 23, 2024 · 3 comments
Closed

How to deploy functions automatically in CI? #2278

drriguz opened this issue Apr 23, 2024 · 3 comments

Comments

@drriguz
Copy link

drriguz commented Apr 23, 2024

Hello,
I'm tring to deploy functions automatically using tekton, and ci is expected to be triggered by git commits. I could not find any document mentioning the way to deploy functions in ci, I think there might be a few options:

  • Since func deploy --remote will create a pipeline to deploy the function, we can reuse the created pipeline and configure a tekton trigger to initialize the pipelinerun
  • May be it's possible to run func deploy --remote directly inside a tekton task?
  • Build the image locally and push to a registry. But then how to deploy the image?

Whic one is recommended?

@drriguz drriguz changed the title How to deploy functions using CI? How to deploy functions automatically in CI? Apr 23, 2024
@lkingland
Copy link
Member

lkingland commented Apr 30, 2024

Hello @drriguz,

Yes, this is a use-case which we think is core to the usage of Functions. I am sorry we don't have documentation or additional resources yet available, but they are on the way!

For now you really have one best option: Run func deploy --remote from within CI/CD (a GitHub Action, for exampple) which will trigger the build and deploy tekton task. You will of course need Tekton installed in your cluster. You will also need to have a container registry ready to go such as docker.io (unless you're running OpenShift which has one built in).

When your CI/CD action runs func deploy --remote, it will send all of the local source code to the cluster for packaging and deployment (no need to run func... from within the cluster; that's automatic.

So if you have been able to build and deploy your Function from your local machine, it will have the registry already set. Commit everything (including the func.yaml). Then, your CI/CD action should have the following pseudocode:

On Merge to main:
Check out your Function's source code (its current state)
Pull the latest `func` binary
run `func deploy --remote`

@lkingland
Copy link
Member

Please re-open if this did not answer your question @drriguz, or join us in the CNCF Slack channel to help put together your CI/CD task.

@drriguz
Copy link
Author

drriguz commented Apr 30, 2024

Please re-open if this did not answer your question @drriguz, or join us in the CNCF Slack channel to help put together your CI/CD task.

Thanks, this solves my problem. In my case, I have a problem building the source in CI because it's air-gapped network, my choice is currently running build on local device and use func deploy --image=xxx option.

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

2 participants