-
Notifications
You must be signed in to change notification settings - Fork 74
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
Respect .funcignore file rules #36
Comments
If someone looking for workaround try this:
It will create and deploy package using Azure Functions Core Tools, which respects rules from |
Note the workaround does work, but it has to download the entire |
@N-Usha Can we mark this as an enhancement? |
Here's a ...
env:
...
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
RELEASE_BUNDLE_PATH: 'release-bundle' # This is a new env var
jobs:
deploy:
runs-on: ubuntu-latest
steps:
... checkout code, install, build ...
# A new step to exclude files from deployment
- name: Copy files to release bundle
shell: bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
rsync -av --prune-empty-dirs --exclude-from .funcignore ./ ${{ env.RELEASE_BUNDLE_PATH }}
popd
- name: Run Azure Functions action
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/${{ env.RELEASE_BUNDLE_PATH }}'
publish-profile: .... But I agree with @aaronadamsCA it should work out of the box without any tricks. Rsync solution works well but unfortunately I've hit another blocker which is files do not get removed from the Azure Function App instance when they're removed in code: #33 (comment) |
@maximivanov I can confirm that with the workaround I'm using, files also don't get deleted during Kudu ZIP deploy, so I believe yours is definitely the cleaner solution until this issue is fixed. For the other issue, I think projectkudu/kudu#3183 is the relevant issue to follow. |
@Hazhzeng @anirudhgarg - Can you please confirm if this is a product limitation? |
Thanks @petyunchik, I will look into this in the upcoming weeks |
Thanks for looking into this. I gave it a try and I can still see Here's the repo to reproduce: https://github.com/maximivanov/azure-functions-cd-github-actions Once cloud resources are provisioned (I use Terraform for that), I trigger the CD workflow in the repo. Expected: |
Yes, .funcignore is not respected. But that doesn't mean you can't do it with other standard ways to ignore any unwanted file. The following workflow build and deploy a python app to a dev slot on Azure Function app, when pushed to main branch on GitHub, without a .funcignore file (you can adapt it to your app), and without the rync trick (@maximivanov). The main part for ignoring is the last part on build stage (specifically the path part): - name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: ${{ env.APP_INTERNAL_NAME }}
path: |
.
!venv/
!README.md
!.gitignore It adds everything (with .), and ignores '.venv' folder, README.md (which is only important for GitHub), and .gitignore (which also is only important for GitHub). name: Deploy Python app to Azure Function app (dev/stage slot)
on:
push:
branches:
- main
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_NAME: test-app
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
PYTHON_VERSION: '3.9'
APP_INTERNAL_NAME: 'test-app'
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Python ${{ env.PYTHON_VERSION }} Enviroment
uses: actions/setup-python@v1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: pip install -r requirements.txt
# Tests here
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: ${{ env.APP_INTERNAL_NAME }}
path: |
.
!venv/
!README.md
!.gitignore
deploy:
runs-on: ubuntu-20.04
needs: build
environment: 'dev'
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: ${{ env.APP_INTERNAL_NAME }}
path: .
- name: 'Deploy to Azure Functions'
uses: Azure/functions-action@v1
id: deploy-to-function
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
slot-name: 'dev'
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE_DEV }}
scm-do-build-during-deployment: true
enable-oryx-build: true |
Ideally, developers would be able to Example:
Can files and directories be added to |
Why is this issue closed? As far as I can tell, |
why even create the |
this is still an issue when pushing code to azure functions from vs code. |
Patterns of
.funcignore
file are ignored during deployment and everything is included under package folder.Would be nice to exclude files in accordance to
.funcignore
rules as it's implemented in Azure Functions Core ToolsThe text was updated successfully, but these errors were encountered: