Skip to content

Commit

Permalink
[FEATURE-BRANCH] v2.0.0 changes (#4869)
Browse files Browse the repository at this point in the history
# Description

This PR includes all the changes related with new Argilla v2.0.0.

**Type of change**

(Please delete options that are not relevant. Remember to title the PR
according to the type of change)

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (change restructuring the codebase without changing
functionality)
- [ ] Improvement (change adding some improvement to an existing
functionality)
- [ ] Documentation update

**How Has This Been Tested**

(Please describe the tests that you ran to verify your changes. And
ideally, reference `tests`)

- [x] Adding new tests.

**Checklist**

- [ ] I added relevant documentation
- [ ] follows the style guidelines of this project
- [ ] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)

---------

# Argilla Community Growers

Thanks for your contribution! As part of our Community Growers
initiative 🌱, we're donating Justdiggit bunds in your name to reforest
sub-Saharan Africa. To claim your Community Growers certificate, please
contact David Berenstein in our Slack community or fill in this form
https://tally.so/r/n9XrxK once your PR has been merged.

# Pull Request Templates

Please go the the `Preview` tab and select the appropriate sub-template:

* [🐞-bug](?expand=1&template=bug.md)
* [📚-documentation](?expand=1&template=docs.md)
* [🆕-features](?expand=1&template=features.md)

# Generic Pull Request Template

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context. List any dependencies that
are required for this change.

Closes #<issue_number>

**Type of change**

(Please delete options that are not relevant. Remember to title the PR
according to the type of change)

- [ ] 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)
- [ ] Refactor (change restructuring the codebase without changing
functionality)
- [ ] Improvement (change adding some improvement to an existing
functionality)
- [ ] Documentation update

**How Has This Been Tested**

(Please describe the tests that you ran to verify your changes. And
ideally, reference `tests`)

- [ ] Test A
- [ ] Test B

**Checklist**

- [ ] I added relevant documentation
- [ ] follows the style guidelines of this project
- [ ] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
  • Loading branch information
frascuchon authored Jun 19, 2024
2 parents 6a0361d + 03c1b28 commit a1ead71
Show file tree
Hide file tree
Showing 1,673 changed files with 85,836 additions and 108,910 deletions.
4 changes: 3 additions & 1 deletion .github/actions/generate-credentials/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def generate_credentials() -> Dict[str, Any]:
credentials = {}
for user in ["owner", "admin", "annotator"]:
logging.info(f"Generating random credential for user '{user}'")
password = generate_password_from_secret(secret=SECRET, salt=f"{GITHUB_REF}/{user}", length=32)
password = generate_password_from_secret(
secret=SECRET, salt=f"{GITHUB_REF}/{user}", length=32
)
credentials[user] = password
return credentials

Expand Down
16 changes: 12 additions & 4 deletions .github/actions/slack-post-credentials/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def get_slack_channel_id(client: WebClient) -> Union[str, None]:
for channel in result["channels"]:
if channel["name"] == SLACK_CHANNEL_NAME:
channel_id = channel["id"]
logging.info(f"Found channel id for '{SLACK_CHANNEL_NAME}' channel: '{channel_id}'")
logging.info(
f"Found channel id for '{SLACK_CHANNEL_NAME}' channel: '{channel_id}'"
)
return channel_id


Expand All @@ -87,7 +89,9 @@ def get_pr_url(pr_number: int) -> str:
return f"https://github.com/argilla-io/argilla/pull/{pr_number}"


def get_thread_ts_pr_message(client: WebClient, channel_id: str, pr_number: int) -> Union[str, None]:
def get_thread_ts_pr_message(
client: WebClient, channel_id: str, pr_number: int
) -> Union[str, None]:
response = client.conversations_history(channel=channel_id, limit=1000)
response.validate()

Expand Down Expand Up @@ -119,7 +123,9 @@ def bot_already_replied(client: WebClient, channel_id: str, thread_ts: str) -> b
return False


def reply_thread_with_credentials(client: WebClient, channel_id: str, thread_ts: str) -> None:
def reply_thread_with_credentials(
client: WebClient, channel_id: str, thread_ts: str
) -> None:
client.chat_postMessage(
channel=channel_id,
text=f"Credentials for PR deployed environment (use as password and API key):\n- URL: {URL}\n- owner: '{OWNER}'\n- admin: '{ADMIN}'\n- annotator: '{ANNOTATOR}'",
Expand Down Expand Up @@ -153,7 +159,9 @@ def reply_thread_with_credentials(client: WebClient, channel_id: str, thread_ts:
pr_number = get_pull_request_number()
if pr_number is None:
logging.error(f"Could not parse `GITHUB_REF` ({GITHUB_REF}) to get PR number")
raise ValueError(f"Could not parse `GITHUB_REF` ({GITHUB_REF}) to get PR number")
raise ValueError(
f"Could not parse `GITHUB_REF` ({GITHUB_REF}) to get PR number"
)

client = get_slack_client()

Expand Down
15 changes: 3 additions & 12 deletions .github/workflows/argilla-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,13 @@ concurrency:
cancel-in-progress: true

on:

workflow_call:

pull_request:
paths:
- "argilla-frontend/**"
types:
- opened
- edited
- reopened
- synchronize
- ready_for_review

jobs:

build:
name: Build argilla-frontend
runs-on: ubuntu-latest
Expand All @@ -28,7 +20,6 @@ jobs:
working-directory: argilla-frontend

steps:

- name: Checkout Code 🛎
uses: actions/checkout@v4

Expand Down Expand Up @@ -61,7 +52,7 @@ jobs:
build_dev_docker_image:
name: Build development argilla-fronted docker image
needs: build
uses: ./.github/workflows/argilla.build-push-dev-frontend-docker.yml
uses: ./.github/workflows/argilla-frontend.build-push-dev-frontend-docker.yml
if: |
!cancelled() &&
github.event_name == 'pull_request' && github.event.pull_request.draft == false
Expand All @@ -75,7 +66,7 @@ jobs:

deploy:
name: Deploy pr environment
uses: ./.github/workflows/argilla.deploy-environment.yml
uses: ./.github/workflows/argilla-frontend.deploy-environment.yml
needs: build_dev_docker_image
if: |
!cancelled() &&
Expand All @@ -84,4 +75,4 @@ jobs:
with:
image-name: argilla/argilla-frontend-for-dev
image-version: ${{ needs.build_dev_docker_image.outputs.version }}
secrets: inherit
secrets: inherit
105 changes: 0 additions & 105 deletions .github/workflows/argilla-server.build-docker-image.yml

This file was deleted.

141 changes: 141 additions & 0 deletions .github/workflows/argilla-server.build-docker-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Build Argilla server docker images

on:
workflow_call:
inputs:
is_release:
description: "True if the images should be built for release"
required: true
type: boolean

publish_latest:
description: "True if the images should be published as latest"
required: true
type: boolean

jobs:
build:
name: Build Argilla server docker images
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version-file: argilla-server/pyproject.toml
cache-dependency-path: argilla-server/pdm.lock
cache: true

- name: Read package info
id: package-info
working-directory: argilla-server
run: |
PACKAGE_VERSION=$(pdm show --version)
PACKAGE_NAME=$(pdm show --name)
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_OUTPUT
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
echo "$PACKAGE_NAME==$PACKAGE_VERSION"
- name: Get Docker image tag from GITHUB_REF
if: ${{ !inputs.is_release }}
id: docker-image-tag-from-ref
uses: ./.github/actions/docker-image-tag-from-ref

- name: Setup environment variables
run: |
if [[ $IS_RELEASE == true ]]; then
echo "PLATFORMS=linux/amd64,linux/arm64" >> $GITHUB_ENV
echo "IMAGE_TAG=v$PACKAGE_VERSION" >> $GITHUB_ENV
else
echo "PLATFORMS=linux/amd64" >> $GITHUB_ENV
echo "IMAGE_TAG=$DOCKER_IMAGE_TAG" >> $GITHUB_ENV
fi
env:
IS_RELEASE: ${{ inputs.is_release }}
PACKAGE_VERSION: ${{ steps.package-info.outputs.PACKAGE_VERSION }}
DOCKER_IMAGE_TAG: ${{ steps.docker-image-tag-from-ref.outputs.docker-image-tag }}

- name: Set up QEMU
if: ${{ inputs.is_release }}
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.AR_DOCKER_USERNAME }}
password: ${{ secrets.AR_DOCKER_PASSWORD }}

- name: Download python package
uses: actions/download-artifact@v4
with:
name: argilla-server
path: argilla-server/docker/server/dist

- name: Build and push `argilla-server` image
uses: docker/build-push-action@v5
with:
context: argilla-server/docker/server
file: argilla-server/docker/server/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: argilla/argilla-server:${{ env.IMAGE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
push: true

- name: Push latest `argilla-server` image
if: ${{ inputs.is_release && inputs.publish_latest }}
uses: docker/build-push-action@v5
with:
context: argilla-server/docker/server
file: argilla-server/docker/server/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: argilla/argilla-server:latest
labels: ${{ steps.meta.outputs.labels }}
push: true

- name: Build and push `argilla-quickstart` image
uses: docker/build-push-action@v5
with:
context: argilla-server/docker/quickstart
file: argilla-server/docker/quickstart/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: argilla/argilla-quickstart:${{ env.IMAGE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ARGILLA_VERSION=${{ env.IMAGE_TAG }}
push: true

- name: Push latest `argilla-quickstart` image
if: ${{ inputs.is_release && inputs.publish_latest }}
uses: docker/build-push-action@v5
with:
context: argilla-server/docker/quickstart
file: argilla-server/docker/quickstart/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: argilla/argilla-quickstart:latest
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ARGILLA_VERSION=${{ env.IMAGE_TAG }}
push: true

- name: Docker Hub Description for `argilla-server`
uses: peter-evans/dockerhub-description@v4
if: ${{ inputs.is_release && inputs.publish_latest }}
with:
username: ${{ secrets.AR_DOCKER_USERNAME }}
password: ${{ secrets.AR_DOCKER_PASSWORD }}
repository: argilla/argilla-server
readme-filepath: argilla-server/README.md

- name: Docker Hub Description for `argilla-quickstart`
uses: peter-evans/dockerhub-description@v4
if: ${{ inputs.is_release && inputs.publish_latest }}
with:
username: ${{ secrets.AR_DOCKER_USERNAME }}
password: ${{ secrets.AR_DOCKER_PASSWORD }}
repository: argilla/argilla-quickstart
readme-filepath: argilla-server/docker/quickstart/README.md
Loading

0 comments on commit a1ead71

Please sign in to comment.