chore: go mod tidy #1000
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
name: deploy | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_TAG: ghcr.io/${{ github.repository }} | |
KUBECTL_VERSION: v1.27.6 | |
DEPLOY_BROKEN: true | |
jobs: | |
oteldb: | |
environment: prod | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
env: | |
KUBECONFIG: /tmp/kubeconfig | |
# Skip deploy commit message contains #skip | |
if: ${{ !contains(github.event.head_commit.message, '!skip') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21.x" | |
cache: false | |
- name: Get Go environment | |
id: go-env | |
run: | | |
echo "cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
echo "modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV | |
echo "goversion=$(go env GOVERSION)" >> $GITHUB_ENV | |
- name: Set up cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.cache }} | |
${{ env.modcache }} | |
key: deploy-${{ runner.os }}-go-${{ env.goversion }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
deploy-${{ runner.os }}-go-${{ env.goversion }} | |
- name: Docker log in | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get short commit SHA | |
id: var | |
shell: bash | |
run: | | |
echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Go build | |
env: | |
CGO_ENABLED: 0 | |
run: | | |
go build -trimpath -buildvcs=false -v ./cmd/oteldb | |
go build -trimpath -buildvcs=false -v ./cmd/otelproxy | |
go build -trimpath -buildvcs=false -v ./cmd/chotel | |
- name: Base image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: deploy.Dockerfile | |
push: true | |
tags: "${{ env.IMAGE_TAG }}:${{ env.sha }}" | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Proxy image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: deploy.proxy.Dockerfile | |
push: true | |
tags: "${{ env.IMAGE_TAG }}/proxy:${{ env.sha }}" | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: ClickHouse OTEL Exporter Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: deploy.chotel.Dockerfile | |
push: true | |
tags: "${{ env.IMAGE_TAG }}/chotel:${{ env.sha }}" | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Generate deployment with SHA version | |
run: sed 's/:main/:${{ env.sha }}/g' .k8s/deployment.yml > .k8s/deployment.deploy.yml | |
- name: Set up kubectl cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/kubectl | |
key: kubectl-${{ env.KUBECTL_VERSION }} | |
- name: Check kubectl | |
id: "kubectl" | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: /tmp/kubectl | |
- name: Download kubectl | |
if: steps.kubectl.outputs.files_exists != 'true' | |
run: | | |
wget -O /tmp/kubectl "https://dl.k8s.io/release/${{ env.KUBECTL_VERSION }}/bin/linux/amd64/kubectl" | |
chmod +x /tmp/kubectl | |
- name: Setup kubeconfig | |
env: | |
KUBE: ${{ secrets.KUBE }} | |
run: .k8s/kubeconfig.sh | |
- uses: azure/setup-helm@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
id: install | |
- name: Deploy | |
if: ${{ env.DEPLOY_BROKEN != 'true' }} | |
run: | | |
/tmp/kubectl apply -f .k8s/deployment.deploy.yml | |
/tmp/kubectl -n faster rollout status deployment otelproxy chotel --timeout=5m | |
- name: Deploy (Helm) | |
if: ${{ env.DEPLOY_BROKEN != 'true' }} | |
run: | | |
helm upgrade --timeout 5m --wait --install otel ./helm/oteldb --namespace faster --values .k8s/values.yml --set image.tag=${{ env.sha }} | |
otelbot: | |
environment: prod | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
env: | |
KUBECONFIG: /tmp/kubeconfig | |
# Skip deploy commit message contains #skip | |
if: ${{ !contains(github.event.head_commit.message, '!skip') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21.x" | |
cache: false | |
- name: Get Go environment | |
id: go-env | |
run: | | |
echo "cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
echo "modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV | |
echo "goversion=$(go env GOVERSION)" >> $GITHUB_ENV | |
- name: Set up cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.cache }} | |
${{ env.modcache }} | |
key: deploy-bot-${{ runner.os }}-go-${{ env.goversion }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
deploy-bot-${{ runner.os }}-go-${{ env.goversion }} | |
- name: Docker log in | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get short commit SHA | |
id: var | |
shell: bash | |
run: | | |
echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Go build | |
env: | |
CGO_ENABLED: 0 | |
run: | | |
go build -trimpath -buildvcs=false -v ./cmd/otelbot | |
- name: Application image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: deploy.otelbot.Dockerfile | |
push: true | |
tags: "${{ env.IMAGE_TAG }}/bot:${{ env.sha }}" | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Migrate image | |
uses: docker/build-push-action@v6 | |
with: | |
file: internal/otelbench/migrate.Dockerfile | |
push: true | |
context: internal/otelbench | |
tags: "${{ env.IMAGE_TAG }}/bot-migrate:${{ env.sha }}" | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Set up kubectl cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/kubectl | |
key: kubectl-${{ env.KUBECTL_VERSION }} | |
- name: Check kubectl | |
id: "kubectl" | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: /tmp/kubectl | |
- name: Download kubectl | |
if: steps.kubectl.outputs.files_exists != 'true' | |
run: | | |
wget -O /tmp/kubectl "https://dl.k8s.io/release/${{ env.KUBECTL_VERSION }}/bin/linux/amd64/kubectl" | |
chmod +x /tmp/kubectl | |
- name: Setup kubeconfig | |
env: | |
KUBE: ${{ secrets.KUBE }} | |
run: .k8s/kubeconfig.sh | |
- uses: azure/setup-helm@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
id: install | |
- name: Deploy (Helm) | |
if: ${{ env.DEPLOY_BROKEN != 'true' }} | |
run: | | |
helm upgrade --timeout 5m --wait --install bot ./helm/otelbot --namespace faster --values .k8s/otelbot.values.yml --set image.tag=${{ env.sha }} | |
otel: | |
environment: prod | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
env: | |
KUBECONFIG: /tmp/kubeconfig | |
# Skip deploy commit message contains #skip | |
if: ${{ !contains(github.event.head_commit.message, '!skip') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Docker log in | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up kubectl cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/kubectl | |
key: kubectl-${{ env.KUBECTL_VERSION }} | |
- name: Check kubectl | |
id: "kubectl" | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: /tmp/kubectl | |
- name: Download kubectl | |
if: steps.kubectl.outputs.files_exists != 'true' | |
run: | | |
wget -O /tmp/kubectl "https://dl.k8s.io/release/${{ env.KUBECTL_VERSION }}/bin/linux/amd64/kubectl" | |
chmod +x /tmp/kubectl | |
- name: Setup kubeconfig | |
env: | |
KUBE: ${{ secrets.KUBE }} | |
run: .k8s/kubeconfig.sh | |
- name: Deploy | |
if: ${{ env.DEPLOY_BROKEN != 'true' }} | |
run: | | |
/tmp/kubectl -n monitoring apply -f .k8s/otel.yml | |
/tmp/kubectl -n monitoring rollout status --timeout=2m deployment otel-collector | |
/tmp/kubectl -n monitoring rollout status --timeout=2m daemonset otel-agent |