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

Improve docker file to allow for caching: Part 1 of many #1036

Closed
wants to merge 5 commits into from

Conversation

ademariag
Copy link
Contributor

@ademariag ademariag commented Sep 10, 2023

Proposed Changes

Part 1 of a series of changes from https://github.com/ademariag/kapitan/tree/master/.github/workflows to improve the build process.

no functional changes expected

Done incrementally for easier review

  • Shuffle things around to take advantage of docker caching
  • Move to use poetry for pre-loading dependencies
  • Adds concurrency to prevent multiple jobs from running for the same code
  • reduce the number of triggered runs

paths-ignore:
- 'docs/**'
workflow_run:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was causing this workflow to checkout master instead of the PR we wanted to look at.

So we were pushing to master on every PR.

We should have checked out github.event.workflow_run.head_branch instead

@@ -1,14 +1,30 @@
---
name: Docker Build and Push
on:
concurrency:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prevents the workflow from running multiple times for the same code

run: |
[ ${{ env.REF_NAME }} == "master" ] && tagname="latest" || tagname=${{ env.REF_NAME }}
docker run -t --rm kapicorp/kapitan:${tagname} --version
# - name: Test Dockerfile in current ref
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment

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

Successfully merging this pull request may close these issues.

1 participant