-
Hello, I am currently trying to build a workflow that enables Continuous Deployment for an web application. I am currently creating 2 different docker images, one for Nginx, and another for the application. Due to the fact that the Nginx docker image doesn’t change that often, but application image does, I am trying to make the Nginx deployment workflow run ONLY when certain files under “nginx” directory has changed. First, I tried with the next configuration to recreate this manner, but due to the fact that “ignore-paths” only ignores the workflow IFF the changed file is under “nginx” directory, changing other files which is not in the “nginx” directory files would still trigger the Application workflow, running both workflows which is… quite not as I expected. Applciation workflow yml
Nginx workflow yml
Another thing I tried, is to mash both the Nginx and Application workflow into one yml file, and try to conditionally change the workflow to run, or not to run the steps within the jobs like the following. But due to the fact that there is currently no way to condition the steps using the file changes, I am currently stuck with how to go on with this method. Application and Nginx workflow yml
I’m hoping to gather any information, or any third-party actions that enables me to run this conditional steps. Any information, suggestion, critisism is welcome. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
Your first two workflows look right to me. The first one will build based on any push that includes changes that are not under the Nginx path but if the push only changes the Nginx path it will not run. The second should run only if the changes are under the Nginx path. Is that not the behavior you are seeing? |
Beta Was this translation helpful? Give feedback.
-
chirspat, Greatly appreciate your reply.
Yes, what you are stating is correct and it is the behaviour I am seeing, but this was not the behaviour I wanted… I am very sorry that I didn’t mention another constraint in the first post, but this is how I wanted things to go. ConstraintsDue to how application container depends on the Nginx configuration, I MUST sequentially run the deployment like the following.
Rules of workflow
Workflow configuration
So, yes But for 3 and 4, specifying I thought of a way to go about this for 2 ways, but I couldn’t find a way to materialize these thoughts. A. If there was a way to configure (order) the workflows sequentially, so that the Nginx workflow always starts and ends before the Application workflow, then I could be able to run Nginx workflow => Application workflow consistantly. (even though, 2 application deployment runs… it gets the job done.) B. The second yml file I presented in the first post, which enables me to conditionally run a step when a file change is detected. This enables me to run the same workflow everytime, and consistantly run the steps in order.
I would like to know if there are any ways to materialize the above thoughts. Thank you for taking your time with me. |
Beta Was this translation helpful? Give feedback.
-
I figured it out… Writing with
But, by writing the path using This was the behaviour I wanted.
Thank you for your help, chirspat :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
Is there another way based on context analysis? |
Beta Was this translation helpful? Give feedback.
-
This should be |
Beta Was this translation helpful? Give feedback.
-
y4m4p:
munrocket:
You could use paths-filter - it’s a 3rd party Github action created exactly for this purpose. Workflows can’t be composed into bigger units and it’s not possible to specify order in which they will run. If you have conditional steps - based on which files were modified, you can either use Having more workflows has a benefit of using just a built-in functionality. Using |
Beta Was this translation helpful? Give feedback.
-
I published this Action that implements an improved “paths-ignore” : https://github.com/fkirc/skip-duplicate-actions It is basically a smarter path-filter that can be used anywhere within a workflow. |
Beta Was this translation helpful? Give feedback.
I figured it out…
Writing with
ignore-path
will not run the workflow if and only if the changed files are under those certain paths.But, by writing the path using
!
like below, this will never run the workflow when there are changes under that specified path.This enables me to condition the workflow which will never run, even when there are other file changes.
This was the behaviour I wanted.
Thank you for your help, chirspat :slight_smile: