-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add_doc_kafka_toolset
- Loading branch information
Showing
15 changed files
with
328 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,115 +6,113 @@ on: | |
|
||
env: | ||
PROJECT_ID: ${{ secrets.GKE_PROD_PROJECT }} | ||
# ` `` GKE_ZONE: us-central1-c # TODO: update to cluster zone | ||
RELEASE_VER : ${{ github.event.release.tag_name }} | ||
# ` `` GKE_ZONE: us-central1-c # TODO: update to cluster zone | ||
RELEASE_VER: ${{ github.event.release.tag_name }} | ||
jobs: | ||
|
||
setup-build-publish-deploy: | ||
name: Build images | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get release version | ||
run: echo "$RELEASE_VER" | ||
|
||
- uses: google-github-actions/[email protected] | ||
with: | ||
service_account_key: ${{ secrets.GKE_PROD_SA_KEY }} | ||
project_id: ${{ secrets.GKE_PROD_PROJECT }} | ||
export_default_credentials: true | ||
|
||
# Configure Docker to use the gcloud command-line tool as a credential helper for authentication | ||
- run: |- | ||
gcloud auth configure-docker us-central1-docker.pkg.dev | ||
- run: |- | ||
gcloud config get-value project | ||
- run: |- | ||
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 | ||
chmod a+x skaffold | ||
- name: Update package version | ||
run: | | ||
sed -i 's/0.0.0/${{env.RELEASE_VER}}/g' src/robusta/_version.py helm/robusta/Chart.yaml helm/robusta/values.yaml | ||
sed -i 's/version = "0.0.0"/version = "${{env.RELEASE_VER}}"/g' pyproject.toml | ||
sed -i 's/0.0.1/${{env.RELEASE_VER}}/g' helm/robusta/Chart.yaml | ||
# Set up the buildx to run build for multiple platforms | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@c5ffa2a61740d9877bd1f40899a87c8ec93b0d9f | ||
|
||
- name: Docker Setup Buildx | ||
uses: docker/setup-buildx-action@bea6a01aa40b4d58b0382d47e1c4a70137af67b1 | ||
with: | ||
config-inline: | | ||
[worker.oci] | ||
enabled = true | ||
platforms = [ "linux/amd64", "linux/arm64" ] | ||
# see https://github.com/GoogleContainerTools/skaffold/issues/4842 | ||
- name: Cache skaffold image builds & config | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.skaffold/ | ||
key: fixed-${{ github.sha }} | ||
restore-keys: | | ||
fixed-${{ github.sha }} | ||
fixed- | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build with skaffold | ||
run: ./skaffold build --profile release --file-output=container-ids.json --tag='${{env.RELEASE_VER}}' | ||
|
||
|
||
- name: Save artifact with tags of built containers | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: container-ids | ||
path: container-ids.json | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install twine | ||
- name: Prepare pypi dist | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.0 | ||
poetry config virtualenvs.create false | ||
poetry install --extras "all" | ||
poetry publish --build -u __token__ -p ${{ secrets.PYPI_PROJECT_TOKEN }} | ||
- name: Save artifact with helm chart | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: helm-chart | ||
path: helm/robusta/ | ||
|
||
- name: Release Docker to Dockerhub | ||
run: |- | ||
docker buildx build \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--platform linux/arm64,linux/amd64 \ | ||
--cache-from us-central1-docker.pkg.dev/genuine-flight-317411/devel/robusta:cache \ | ||
--tag robustadev/robusta-runner:${{env.RELEASE_VER}} \ | ||
--push \ | ||
. | ||
- name: Upload helm chart | ||
run: | | ||
cd helm && ./upload_chart.sh | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get release version | ||
run: echo "$RELEASE_VER" | ||
|
||
- uses: google-github-actions/[email protected] | ||
with: | ||
service_account_key: ${{ secrets.GKE_PROD_SA_KEY }} | ||
project_id: ${{ secrets.GKE_PROD_PROJECT }} | ||
export_default_credentials: true | ||
|
||
# Configure Docker to use the gcloud command-line tool as a credential helper for authentication | ||
- run: |- | ||
gcloud auth configure-docker us-central1-docker.pkg.dev | ||
- run: |- | ||
gcloud config get-value project | ||
- run: |- | ||
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 | ||
chmod a+x skaffold | ||
- name: Update package version | ||
run: | | ||
sed -i 's/0.0.0/${{env.RELEASE_VER}}/g' src/robusta/_version.py helm/robusta/Chart.yaml helm/robusta/values.yaml | ||
sed -i 's/version = "0.0.0"/version = "${{env.RELEASE_VER}}"/g' pyproject.toml | ||
sed -i 's/0.0.1/${{env.RELEASE_VER}}/g' helm/robusta/Chart.yaml | ||
# Set up the buildx to run build for multiple platforms | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@c5ffa2a61740d9877bd1f40899a87c8ec93b0d9f | ||
|
||
- name: Docker Setup Buildx | ||
uses: docker/setup-buildx-action@bea6a01aa40b4d58b0382d47e1c4a70137af67b1 | ||
with: | ||
config-inline: | | ||
[worker.oci] | ||
enabled = true | ||
platforms = [ "linux/amd64", "linux/arm64" ] | ||
# see https://github.com/GoogleContainerTools/skaffold/issues/4842 | ||
- name: Cache skaffold image builds & config | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.skaffold/ | ||
key: fixed-${{ github.sha }} | ||
restore-keys: | | ||
fixed-${{ github.sha }} | ||
fixed- | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build with skaffold | ||
run: ./skaffold build --profile release --file-output=container-ids.json --tag='${{env.RELEASE_VER}}' | ||
|
||
- name: Save artifact with tags of built containers | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: container-ids | ||
path: container-ids.json | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install twine | ||
- name: Prepare pypi dist | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.0 | ||
poetry config virtualenvs.create false | ||
poetry install --extras "all" | ||
poetry publish --build -u __token__ -p ${{ secrets.PYPI_PROJECT_TOKEN }} | ||
- name: Save artifact with helm chart | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: helm-chart | ||
path: helm/robusta/ | ||
|
||
- name: Release Docker to Dockerhub | ||
run: |- | ||
docker buildx build \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--platform linux/arm64,linux/amd64 \ | ||
--cache-from us-central1-docker.pkg.dev/genuine-flight-317411/devel/robusta:cache \ | ||
--tag robustadev/robusta-runner:${{env.RELEASE_VER}} \ | ||
--push \ | ||
. | ||
- name: Upload helm chart | ||
run: | | ||
cd helm && ./upload_chart.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,69 +3,69 @@ name: Test robusta with pytest | |
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
check: | ||
name: Pre-commit checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- uses: pre-commit/[email protected] | ||
check: | ||
name: Pre-commit checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- uses: pre-commit/[email protected] | ||
|
||
run_tests: | ||
needs: check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
run_tests: | ||
needs: check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
|
||
# setup a KIND cluster for tests which need a kubernetes image | ||
- name: Create k8s Kind Cluster | ||
uses: helm/[email protected] | ||
- name: Output KIND info | ||
run: | | ||
kubectl config get-contexts | ||
# setup a KIND cluster for tests which need a kubernetes image | ||
- name: Create k8s Kind Cluster | ||
uses: helm/[email protected] | ||
- name: Output KIND info | ||
run: | | ||
kubectl config get-contexts | ||
# install robusta so that we can run tests on it | ||
- name: Install Robusta | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.0 | ||
poetry config virtualenvs.create false | ||
poetry install --extras "all" | ||
# Install tabulate version that fixes column width wrapping. Cannot be added to pypi as a git dependency, so adding it here | ||
pip install git+https://github.com/astanin/python-tabulate.git@b2c26bcb70e497f674b38aa7e29de12c0123708a#egg=tabulate | ||
# robusta-cli is a separate project now, it needs to be installed for gen-config | ||
pip install robusta-cli | ||
# install robusta so that we can run tests on it | ||
- name: Install Robusta | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.0 | ||
poetry config virtualenvs.create false | ||
poetry install --extras "all" | ||
# Install tabulate version that fixes column width wrapping. Cannot be added to pypi as a git dependency, so adding it here | ||
pip install git+https://github.com/astanin/python-tabulate.git@b2c26bcb70e497f674b38aa7e29de12c0123708a#egg=tabulate | ||
# robusta-cli is a separate project now, it needs to be installed for gen-config | ||
pip install robusta-cli | ||
# build robusta docker images for tests which run in-cluster on KIND | ||
- run: |- | ||
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 | ||
chmod a+x skaffold | ||
- name: Cache skaffold image builds & config | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.skaffold/ | ||
key: fixed-${{ github.sha }} | ||
restore-keys: | | ||
fixed-${{ github.sha }} | ||
fixed- | ||
- name: Build with skaffold | ||
run: | | ||
echo 'building with tag test-${{ github.sha }}' | ||
./skaffold build --push=false --file-output=container-ids.json --tag='test-${{ github.sha }}' | ||
kind load docker-image --name chart-testing 'us-central1-docker.pkg.dev/genuine-flight-317411/devel/robusta-runner:test-${{ github.sha }}' | ||
# build robusta docker images for tests which run in-cluster on KIND | ||
- run: |- | ||
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 | ||
chmod a+x skaffold | ||
- name: Cache skaffold image builds & config | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.skaffold/ | ||
key: fixed-${{ github.sha }} | ||
restore-keys: | | ||
fixed-${{ github.sha }} | ||
fixed- | ||
- name: Build with skaffold | ||
run: | | ||
echo 'building with tag test-${{ github.sha }}' | ||
./skaffold build --push=false --file-output=container-ids.json --tag='test-${{ github.sha }}' | ||
kind load docker-image --name chart-testing 'us-central1-docker.pkg.dev/genuine-flight-317411/devel/robusta-runner:test-${{ github.sha }}' | ||
# update helm chart to use the image we just built | ||
- name: Update package version | ||
run: | | ||
sed -i 's/0.0.0/test-${{ github.sha }}/g' helm/robusta/Chart.yaml helm/robusta/values.yaml | ||
# update helm chart to use the image we just built | ||
- name: Update package version | ||
run: | | ||
sed -i 's/0.0.0/test-${{ github.sha }}/g' helm/robusta/Chart.yaml helm/robusta/values.yaml | ||
# run the actual tests | ||
- name: Test Robusta | ||
env: | ||
PYTEST_SLACK_TOKEN: ${{ secrets.PYTEST_SLACK_TOKEN }} | ||
PYTEST_IN_CLUSTER_SLACK_TOKEN: ${{ secrets.PYTEST_IN_CLUSTER_SLACK_TOKEN }} | ||
run: | | ||
pytest -s --image='us-central1-docker.pkg.dev/genuine-flight-317411/devel/robusta-runner:test-${{ github.sha }}' | ||
# run the actual tests | ||
- name: Test Robusta | ||
env: | ||
PYTEST_SLACK_TOKEN: ${{ secrets.PYTEST_SLACK_TOKEN }} | ||
PYTEST_IN_CLUSTER_SLACK_TOKEN: ${{ secrets.PYTEST_IN_CLUSTER_SLACK_TOKEN }} | ||
run: | | ||
pytest -s --image='us-central1-docker.pkg.dev/genuine-flight-317411/devel/robusta-runner:test-${{ github.sha }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.