Skip to content

fix: synchronize tf init to avoid plugin race condition #524

fix: synchronize tf init to avoid plugin race condition

fix: synchronize tf init to avoid plugin race condition #524

Workflow file for this run

name: Go
on:
push:
tags:
- '*'
pull_request:
branches: [ main ]
jobs:
lint:
runs-on: self-hosted
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.23.5
- name: Run lint
uses: golangci/golangci-lint-action@v6.1.0
with:
version: latest
args: --timeout 10m0s
tests:
runs-on: self-hosted
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.23.5
- name: Install dependencies
run: sudo apt install make -y
- name: Run tests
run: make test-ci
docker-build-amd64:
runs-on: [self-hosted, arch:amd64]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs:
- tests
- lint
permissions:
packages: write
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: tfgco/${{ github.event.repository.name }}
tags: |
type=ref,event=tag,suffix=-amd64
type=semver,pattern={{version}},suffix=-amd64
type=semver,pattern={{major}}.{{minor}},suffix=-amd64
- name: Build and Push AMD64 Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=amd64
cache-to: type=gha,mode=max,scope=amd64
provenance: false
sbom: false
docker-build-arm64:
runs-on: [self-hosted, arch:arm64]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs:
- tests
- lint
permissions:
packages: write
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: tfgco/${{ github.event.repository.name }}
tags: |
type=ref,event=tag,suffix=-arm64
type=semver,pattern={{version}},suffix=-arm64
type=semver,pattern={{major}}.{{minor}},suffix=-arm64
- name: Build and Push ARM64 Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=arm64
cache-to: type=gha,mode=max,scope=arm64
provenance: false
sbom: false
docker-manifest:
runs-on: self-hosted
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs:
- docker-build-amd64
- docker-build-arm64
permissions:
packages: write
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata for multi-arch manifest
id: meta
uses: docker/metadata-action@v4
with:
images: tfgco/${{ github.event.repository.name }}
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Create and push multi-arch manifest
run: |
REPO_NAME="tfgco/${{ github.event.repository.name }}"
TAGS="${{ steps.meta.outputs.tags }}"
echo "$TAGS" | while read -r TAG; do
if [ -n "$TAG" ]; then
echo "Creating manifest for $TAG"
docker manifest create $TAG \
${TAG}-amd64 \
${TAG}-arm64
docker manifest annotate $TAG ${TAG}-amd64 --arch amd64
docker manifest annotate $TAG ${TAG}-arm64 --arch arm64
docker manifest push $TAG
fi
done