Skip to content

fix(api): [KDL6-293] fix issue when creating new user (#1144) #74

fix(api): [KDL6-293] fix issue when creating new user (#1144)

fix(api): [KDL6-293] fix issue when creating new user (#1144) #74

Workflow file for this run

name: "[Component] Build image with tags"
env:
DOCKERHUB_USER: konstellation
DOCKERHUB_REPO: kdl # in runtime env.COMPONENT: "kdl-${{ env.COMPONENT }}"
GHCR_REGISTRY: ghcr.io
GHCR_REPO: ${{ github.repository }}
on:
push:
tags:
- "*"
jobs:
build-component:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
attestations: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Prepare metadata to build
id: prepare_metadata
run: |
# get TAG_NAME
TAG_NAME=${{ github.ref_name }}
COMPONENT=$(echo ${{ github.ref_name }} | sed -E 's/-v[0-9]?.*//g')
WORKDIR_COMPONENT=$(echo ${{ github.ref_name }} | sed -E 's/-v[0-9]?.*//g')
# check release-candidate
if [[ "${TAG_NAME##*/}" == *-rc.* ]]; then
echo "TAG_NAME_FIXED=develop" >> $GITHUB_ENV
else
echo "TAG_NAME_FIXED=${TAG_NAME##*-v}" >> $GITHUB_ENV
fi
# HOTFIX: only for app nomenclature
if [[ "${COMPONENT}" == "kdl-app" ]]; then
echo "COMPONENT=server" >> $GITHUB_ENV
echo "WORKDIR_COMPONENT=app" >> $GITHUB_ENV
else
# save env
echo "COMPONENT=${COMPONENT}" >> $GITHUB_ENV
echo "WORKDIR_COMPONENT=${WORKDIR_COMPONENT}" >> $GITHUB_ENV
fi
- name: Set Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPO }}-${{ env.COMPONENT }}
${{ env.GHCR_REGISTRY }}/${{ env.GHCR_REPO }}/kdl-${{ env.COMPONENT }}
labels: |
org.opencontainers.image.maintainer=Intelygenz - Konstellation Team
org.opencontainers.image.title=kdl-${{ env.COMPONENT }}
org.opencontainers.image.description=${{ env.COMPONENT }} for KDL server
org.opencontainers.image.vendor=Konstellation
tags: |
type=raw,value=${{ env.TAG_NAME_FIXED }}
type=raw,value=develop
type=raw,value=latest,enable=${{ env.TAG_NAME_FIXED != 'develop' }}
type=sha,enable=false
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: "[DOCKERHUB] Log in to Docker Hub"
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "[GHCR] Log in to the Container registry"
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "[kdl-${{ env.COMPONENT }}] Build and push Docker image"
id: push
uses: docker/build-push-action@v6
with:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
context: ./${{ env.WORKDIR_COMPONENT }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
push: true
sbom: true
tags: ${{ steps.meta.outputs.tags }}
- name: "[DOCKERHUB] Update Docker registry description"
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPO }}-${{ env.COMPONENT }}
- name: "[GHCR] Generate artifact"
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_REPO }}/kdl-${{ env.COMPONENT }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache