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

feat: add merge workflow #38

Merged
merged 2 commits into from
Sep 20, 2024
Merged

Conversation

Emnaghz
Copy link
Collaborator

@Emnaghz Emnaghz commented Sep 18, 2024

Motivation

This workflow automates the process of building and pushing Docker images for different parts of the project when changes are pushed to the main branch or triggered manually.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (Storybook)
  • I have added unit tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@Emnaghz Emnaghz self-assigned this Sep 18, 2024
Copy link
Contributor

@marrouchi marrouchi left a comment

Choose a reason for hiding this comment

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

A general remark, I think we can may do the setup of docker and login once to build all the images.

.github/workflows/merge.yml Outdated Show resolved Hide resolved
@Emnaghz
Copy link
Collaborator Author

Emnaghz commented Sep 19, 2024

In the updated workflow, I've optimized the process by separating the tasks into two distinct jobs:

Job 1: Path Filtering
It filters the paths to determine which parts of the codebase have changed and outputs these results to be used by subsequent jobs.

Job 2: Build and Push Docker Images
This job handles the setup of the building environment, the authentication as well as the conditional builds.

Explanation:
When I separated the Docker Hub login process and the environment setup from the build and push steps, I encountered several issues. Each job in GitHub Actions is executed in a separate environment, which means that the authentication status as well as the env setup wasn't shared between other jobs and resulted in many errors.

To address this, I had to ensure that the Docker Hub login and environment setup steps were completed in the same job as the build and push operations.

Copy link
Contributor

@marrouchi marrouchi left a comment

Choose a reason for hiding this comment

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

I forgot that we need to build the docker image for nlu as well "hexabot-nlu"

file: ./frontend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hexabot-frontend:latest
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hexabot-frontend:latest
tags: hexastack/hexabot-ui:latest

if: ${{ needs.paths-filter.outputs.widget == 'true' }}
uses: docker/build-push-action@v6
with:
context: ./
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
context: ./
context: ./widget

I think we need to set the widget context like this. Can you push and check ?

file: ./api/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hexabot-api:latest
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hexabot-api:latest
tags: hexastack/hexabot-api:latest

@marrouchi marrouchi merged commit eb3f53d into Hexastack:main Sep 20, 2024
2 checks passed
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.

2 participants