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

ci: publish cli in separate workflow #803

Merged
merged 4 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 0 additions & 107 deletions .github/workflows/main.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Release Odigos CLI

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag'
required: true

permissions:
contents: write
packages: write

env:
DOCKERHUB_ORG: "keyval"

jobs:
release:
runs-on:
labels: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.tag }}

- name: Set env
id: vars
run: |
# echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "tag=${{github.event.inputs.tag}}" >> $GITHUB_OUTPUT
SHORT_COMMIT=$(git rev-parse --short HEAD)
echo "short_commit=${SHORT_COMMIT}" >> $GITHUB_ENV
echo "date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT

- name: Verify Components Image Ready
run: |
declare -a REPOS=("odigos-autoscaler" "odigos-scheduler" "odigos-instrumentor" "odigos-odiglet" "odigos-enterprise-odiglet")
TAG_TO_CHECK=${{ steps.vars.outputs.tag }}

for REPO in "${REPOS[@]}"; do
echo "Checking tag $TAG_TO_CHECK in $REPO..."
TAGS_JSON=$(curl -s "https://hub.docker.com/v2/repositories/${{ env.DOCKERHUB_ORG }}/$REPO/tags/")
if echo "$TAGS_JSON" | grep -q "\"name\":\"$TAG_TO_CHECK\""; then
echo "Tag $TAG_TO_CHECK exists in Docker Hub repository $REPO."
else
echo "Tag $TAG_TO_CHECK does not exist in Docker Hub repository $REPO."
exit 1
fi
done

- uses: actions/setup-go@v4
with:
go-version: '1.21.0'

- uses: actions/setup-node@v4
with:
node-version: 18

- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}

- uses: ko-build/setup-ko@v0.6

- name: publish cli image to docker registries
working-directory: ./cli
env:
KO_DOCKER_REPO: ${{ env.DOCKERHUB_ORG }}/odigos-cli
KO_CONFIG_PATH: ./.ko.yaml
VERSION: ${{ steps.vars.outputs.tag }}
SHORT_COMMIT: ${{ steps.vars.outputs.short_commit }}
DATE: ${{ steps.vars.outputs.date }}
run: |
ko build --bare --tags latest --tags ${{ steps.vars.outputs.tag }} --platform=all .
55 changes: 54 additions & 1 deletion .github/workflows/publish-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
tag-modules:
runs-on: ubuntu-latest
runs-on: large-runner
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -33,4 +33,57 @@ jobs:
- name: Push Module Tags
run: |
git push origin --tags

publish-docker-images:
runs-on: ubuntu-latest
blumamir marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract Tag
id: extract_tag
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Autoscaler Image
uses: docker/build-push-action@v5
with:
push: true
tags: |
keyval/odigos-autoscaler:${{ steps.vars.outputs.tag }}
build-args: SERVICE_NAME=autoscaler
platforms: linux/amd64,linux/arm64

- name: Build Scheduler Image
uses: docker/build-push-action@v5
with:
push: true
tags: |
keyval/odigos-scheduler:${{ steps.vars.outputs.tag }}
build-args: SERVICE_NAME=scheduler
platforms: linux/amd64,linux/arm64

- name: Build Instrumentor Image
uses: docker/build-push-action@v5
with:
push: true
tags: |
keyval/odigos-instrumentor:${{ steps.vars.outputs.tag }}
build-args: SERVICE_NAME=instrumentor
platforms: linux/amd64,linux/arm64

- name: Build Odiglet Image
uses: docker/build-push-action@v5
with:
file: odiglet/Dockerfile
push: true
tags: |
keyval/odigos-odiglet:${{ steps.vars.outputs.tag }}
platforms: linux/amd64,linux/arm64