Skip to content

Commit

Permalink
multi build
Browse files Browse the repository at this point in the history
  • Loading branch information
eumel8 committed Jan 21, 2024
1 parent db959bd commit 2ad21be
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 44 deletions.
82 changes: 38 additions & 44 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,55 +1,49 @@
name: Build Image & Chart

name: Build Image
on: push
# push:
# branches:
# - main

jobs:
build:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4
- name: Install Cosign
uses: sigstore/cosign-installer@main
with:
cosign-release: 'v2.2.0'
- name: Login Build Sign Push
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to MTR
uses: docker/login-action@v3
with:
registry: mtr.devops.telekom.de
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
mtr.devops.telekom.de/caas/entsoe:latest
mtr.devops.telekom.de/caas/entsoe:$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
ghcr.io/caas-team/entsoe:latest
ghcr.io/caas-team/entsoe:$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
- name: Sign Push
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${GHR} -u ${{ github.actor }} --password-stdin
docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}" ${MTR}
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
export DOCKER_BUILDKIT=1
docker build -f Dockerfile -t ${GHR}/${{ github.repository_owner }}/${IMAGE}:${VERSION} .
docker tag ${GHR}/${{ github.repository_owner }}/${IMAGE}:${VERSION} ${MTR}/caas/${IMAGE}:${VERSION}
docker push ${GHR}/${{ github.repository_owner }}/${IMAGE}:${VERSION}
docker push ${MTR}/${ORG}/${IMAGE}:${VERSION}
cosign sign --key env://COSIGN_KEY --tlog-upload=false ${GHR}/${{ github.repository_owner }}/${IMAGE}:${VERSION}
cosign sign --key env://COSIGN_KEY --tlog-upload=false ${MTR}/${ORG}/${IMAGE}:${VERSION}
cosign sign --key env://COSIGN_KEY --tlog-upload=false mtr.devops.telekom.de/caas/entsoe:latest
cosign sign --key env://COSIGN_KEY --tlog-upload=false mtr.devops.telekom.de/caas/entsoe:${VERSION}
cosign sign --key env://COSIGN_KEY --tlog-upload=false ghcr.io/caas-team/entsoe:latest
cosign sign --key env://COSIGN_KEY --tlog-upload=false ghcr.io/caas-team/entsoe:${VERSION}
env:
IMAGE: entsoe
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
GHR: ghcr.io
MTR: mtr.devops.telekom.de
ORG: caas
VERSION: $(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
COSIGN_KEY: ${{secrets.COSIGN_KEY}}
#COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}
- name: Helm lint & package & push
run: |
cd chart
helm repo add kepler https://sustainable-computing-io.github.io/kepler-helm-chart
helm registry login ${GHR} -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
helm registry login ${MTR} -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
helm dependency build
helm lint .
helm package .
helm push $(ls *.tgz| head -1) oci://${GHR}/${{ github.repository_owner }}/charts
helm push $(ls *.tgz| head -1) oci://${MTR}/${ORG}/charts
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
GHR: ghcr.io
MTR: mtr.devops.telekom.de
ORG: caas

34 changes: 34 additions & 0 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build Chart

on: push
# push:
# branches:
# - main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install Cosign
uses: sigstore/cosign-installer@main
with:
cosign-release: 'v2.2.0'
- name: Helm lint & package & push
run: |
cd chart
helm repo add kepler https://sustainable-computing-io.github.io/kepler-helm-chart
helm registry login ${GHR} -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
helm registry login ${MTR} -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
helm dependency build
helm lint .
helm package .
helm push $(ls *.tgz| head -1) oci://${GHR}/${{ github.repository_owner }}/charts
helm push $(ls *.tgz| head -1) oci://${MTR}/${ORG}/charts
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
GHR: ghcr.io
MTR: mtr.devops.telekom.de
ORG: caas

0 comments on commit 2ad21be

Please sign in to comment.