-
Notifications
You must be signed in to change notification settings - Fork 3
/
prdContainerBuild.sh
executable file
·55 lines (43 loc) · 2.26 KB
/
prdContainerBuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
#############################################################################
# Script Name : containerBuild.sh
# Description : Build container images with Git commit as a tag
# Args :
# Author : [email protected]
# Issues : Issues&PR https://github.com/beezy-dev/kleidi.git
#############################################################################
set -euo pipefail
# Define some colours for later
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[1;34m'
NC='\033[0m' # No Color
# Define variables
VERSION=$(git log -1 --pretty=%h)
GITREPO="https://github.com/beezy-dev/kleidi.git"
CONTREG="ghcr.io/beezy-dev/kleidi-kms-plugin"
INITREG="ghcr.io/beezy-dev/kleidi-kms-init"
BUILDDT=$(date '+%F_%H:%M:%S' )
STR="'$*'"
# echo
# echo -e "${NC}Running gosec with report ${BLUE}results.sarif${NC}."
# gosec -no-fail -fmt sarif -out results.sarif ./...
# echo
# echo -e "${NC}Git commit with message ${BLUE}$STR${NC}."
# git add --all && git commit -m "$STR"
# echo -e "${NC}Git push to ${BLUE}$GITREPO${NC}."
# git push
echo -e "${NC}Building kleidi vault container image ${BLUE}$CONTREG:$VERSION${NC} on ${BLUE}$BUILDDT${NC}."
podman build -f Containerfile-kleidi-kms-vault -t "$CONTREG:vault-$VERSION" -t "$CONTREG:vault-latest" --build-arg VERSION="$VERSION"
echo -e "${NC}Building kleidi hsm container image ${BLUE}$CONTREG:$VERSION${NC} on ${BLUE}$BUILDDT${NC}."
podman build -f Containerfile-kleidi-kms-hsm -t "$CONTREG:hsm-$VERSION" -t "$CONTREG:hsm-latest" --build-arg VERSION="$VERSION"
echo -e "${NC}Container pushed to push to ${BLUE}$CONTREG${NC} with tags ${BLUE}$VERSION${NC} and ${BLUE}dev${NC}."
podman push $CONTREG:vault-$VERSION
podman push $CONTREG:hsm-$VERSION
podman push $CONTREG:vault-latest
podman push $CONTREG:hsm-latest
echo -e "${NC}Building kleidi hsm init container image ${BLUE}$INITREG:$VERSION${NC} on ${BLUE}$BUILDDT${NC}."
podman build -f configuration/kleidi-init/Containerfile -t "$INITREG:hsm-$VERSION" -t "$INITREG:hsm-latest" --build-arg VERSION="$VERSION"
podman push $INITREG:hsm-$VERSION
podman push $INITREG:hsm-latest