-
Hi Everyone, I’m running into an issue where GitHub action/runner (or docker/git) is not using my latest pushed changes or it just reads and builds the Master branch rather than the modified branch. For example, I added an extra print out line but when I execute docker container logs I don’t see the new print out.
I tried different combinations and so many changes across all files and still didn’t get to work. So, I really would love if someone can point me out to the right direction or the solution. Setup My GitHub Action/workflow contents
My Docker-compose contents:
My Dockerfile contents (Generated by Visual Studio 2019)
If any extra details needed please let me know, Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
When you push a new commit to a branch in your repository, if you want this new pushed commit can trigger a workflow to build, test or release the latest source code, you need to do the things below:
the checkout action will only fetch “commit1” from the develop branch by default.
If the problem still exists, please make sure you have enabled debug logging in your repository, and share the repository with us, so that we can check more detailed logs of the workflow runs to analyze the root cause. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the help. Nothing worked as I’m the only developer that is working on the project (a PoC) and tried to have another runner on my local PC and same issue. I created a mini repo they reproduce my problem. Repo Url: https://github.com/alwaqfi/CashierRepo I tried 2 runes on the repo
Thanks |
Beta Was this translation helpful? Give feedback.
-
From the repository you shared, I do not see the error you reported. If I have missed something, please feel free to tell me. |
Beta Was this translation helpful? Give feedback.
-
Thank you, The issue is when the action is executed and containers are created but what is in the containers are not my commit contents. The outputs in my last reply were after the GitHub action completely successfully and containers were created and started. The CI/CD (docker-*) logic seems good, the GitHub action logs seems fine, but what is deployed is not my last commit that the action executed when I pushed it. I thought something is happening on our side like caching issue. So before I reply, I cloned the repo on my personal machine then executed the action and was able to reproduce the same issue. Any idea how to proceed? Note: I’m new to GitHub actions and Docker in general, so the content of the files looks fine to me. Thanks |
Beta Was this translation helpful? Give feedback.
-
Yes, the problem should be caused by the Docker Cache. In the same host machine, by default Docker will cache the results of the first build of a Dockerfile, allowing subsequent builds to be super fast. To avoid the issues caused by the Docker Cache, you can try the following options of the ‘docker-compose up’ command (more details, see here):
|
Beta Was this translation helpful? Give feedback.
-
Thank you so much, The –force-recreate didn’t work. Because I already executing docker-compose down then up, so this should recreate the containers. The issue seems is in the cached images. So by Adding a new command to my github action solved this issue. So, my Github action looks like this now:
Thanks again, |
Beta Was this translation helpful? Give feedback.
@aalwaqfi,
Yes, the problem should be caused by the Docker Cache.
In the same host machine, by default Docker will cache the results of the first build of a Dockerfile, allowing subsequent builds to be super fast.
However, the cache is used pretty aggressively and may cause issues when you want the updated output of a RUN or ENTRYPOINT instruction to make it into the new container. As it stands, unless the Dockerfile itself changes (especially the RUN or ENTRYPOINT instruction changes, and thus invalidates Docker’s on-host cache), Docker will reuse the previous results from cache. This is clearly disadvantageous when the RUN…