-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Refactor GitHub Actions workflows to use a reusable Docker build/push workflow #54
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,28 +6,11 @@ on: | |
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| uses: factly/gopie-ee/.github/workflows/docker-build-push.yaml@develop | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's check if the file exists and examine its content
if [ -f ".github/workflows/web-app.yaml" ]; then
echo "=== File: .github/workflows/web-app.yaml ==="
cat -n ".github/workflows/web-app.yaml"
else
echo "File not found, searching for it..."
find . -name "web-app.yaml" -o -name "*web-app*" 2>/dev/null | head -20
fiRepository: factly/gopie Length of output: 597 🏁 Script executed: # Also check for other workflow files to understand the pattern
ls -la .github/workflows/ 2>/dev/null || echo "Directory not found"Repository: factly/gopie Length of output: 560 🏁 Script executed: # Let's also check if there's a server-prod workflow mentioned in the scratchpad
if [ -f ".github/workflows/server-prod.yaml" ]; then
echo "=== File: .github/workflows/server-prod.yaml (for context) ==="
cat -n ".github/workflows/server-prod.yaml"
fiRepository: factly/gopie Length of output: 980 Pin the reusable workflow reference to a commit SHA instead of This workflow is triggered on tag pushes and uses Suggested change- uses: factly/gopie-ee/.github/workflows/docker-build-push.yaml@develop
+ uses: factly/gopie-ee/.github/workflows/docker-build-push.yaml@<pinned-commit-sha>🤖 Prompt for AI Agents |
||
| with: | ||
| tags: asia-south1-docker.pkg.dev/factly-prod/gopie/web:${{ github.ref_name }} | ||
| context: web | ||
| dockerfile: web/Dockerfile.prod | ||
| permissions: | ||
| contents: 'read' | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Set env | ||
| run: | | ||
| if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
| echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
| else | ||
| echo "RELEASE_VERSION=latest" >> $GITHUB_ENV | ||
| fi | ||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Build and push Gopie Web App Docker image to Docker Hub | ||
| uses: docker/build-push-action@v4 | ||
| with: | ||
| push: true | ||
| tags: factly/gopie-web:${{ env.RELEASE_VERSION }} | ||
| context: web | ||
| file: web/Dockerfile.prod | ||
| contents: read | ||
| id-token: write | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: factly/gopie
Length of output: 917
🏁 Script executed:
Repository: factly/gopie
Length of output: 262
Pin the reusable workflow to an immutable ref before using it in release jobs.
GitHub lets reusable workflows be referenced by branch, tag, or SHA, but explicitly calls the commit SHA the safest option for stability and security. Keeping both release jobs on
@developmeans a future change infactly/gopie-eecan silently change or break tagged production builds, and full workflow reruns may resolve that branch again instead of preserving the original workflow version. (docs.github.com)Suggested change
Also applies to line 18.
🤖 Prompt for AI Agents