Compare commits
2 Commits
f08ffe10d8
...
3a9dc1ae21
Author | SHA1 | Date |
---|---|---|
Philippe Caseiro | 3a9dc1ae21 | |
Philippe Caseiro | 13ac2b6959 |
|
@ -13,20 +13,16 @@ symfonyAppPipeline('ubuntu:22.04', [
|
|||
String currentTag = sh(script: 'git tag --points-at HEAD | head -n 1', returnStdout: true).trim()
|
||||
// Retrieve default tag
|
||||
String defaultTag = sh(returnStdout: true, script: 'git describe --always').trim()
|
||||
container.buildAndPublishImage([
|
||||
'imageName': 'reg.cadoles.com/pcaseiro/myapplication-standalone',
|
||||
// Use current tag or default tag if not defined
|
||||
'imageTag': defaultTag,
|
||||
'dockerfile': './misc/images/myapplication-standalone/Dockerfile',
|
||||
'dryRun': false
|
||||
])
|
||||
container.buildAndPublishImage([
|
||||
'imageName': 'reg.cadoles.com/pcaseiro/myapplication-kube',
|
||||
// Use current tag or default tag if not defined
|
||||
'imageTag': defaultTag,
|
||||
'dockerfile': './misc/images/myapplication-kube/Dockerfile',
|
||||
'dryRun': false
|
||||
])
|
||||
job('Building docker images') {
|
||||
steps {
|
||||
shell('make')
|
||||
}
|
||||
}
|
||||
job('Publishing docker images') {
|
||||
steps {
|
||||
shell('make release')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
8
Makefile
8
Makefile
|
@ -2,9 +2,11 @@
|
|||
# Makefile for Cadoles SP
|
||||
################################
|
||||
|
||||
IMAGE_REPO := reg.cadoles.com/cadoles
|
||||
IMAGE_VERSION ?= 0.0.1
|
||||
COMMIT_ID ?= $(shell git rev-parse --short --verify HEAD)
|
||||
CURRENT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD | tr -c '[:alnum:]\n\r' '_'| tr '[:upper:]' '[:lower:]')
|
||||
|
||||
IMAGE_REPO ?= reg.cadoles.com/cadoles
|
||||
IMAGE_VERSION ?= 0.0.1-$(CURRENT_BRANCH)
|
||||
|
||||
DAY_SUFFIX_TAG ?= $(shell date +%Y%m%d)
|
||||
|
||||
include main.mk
|
||||
|
|
9
main.mk
9
main.mk
|
@ -28,12 +28,12 @@ define install_trivy
|
|||
endef
|
||||
|
||||
define release_image
|
||||
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG) ; \
|
||||
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(COMMIT_ID) ; \
|
||||
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION); \
|
||||
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:latest ; \
|
||||
docker push $(IMAGE_REPO)/$1:latest ; \
|
||||
docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION) ; \
|
||||
docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG)
|
||||
docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(COMMIT_ID)
|
||||
endef
|
||||
|
||||
#list:
|
||||
|
@ -57,9 +57,12 @@ release: ${IMAGES_DIR}/*
|
|||
@for name in $(basename $(notdir $^)); do \
|
||||
$(call release_image,$${name},base); \
|
||||
done;\
|
||||
git tag -f -a $(IMAGE_VERSION) -m "Version $(IMAGE_VERSION) released"; \
|
||||
git tag -f -a $(IMAGE_VERSION)-$(COMMIT_ID) -m "Version $(IMAGE_VERSION)-$(COMMIT_ID) released"; \
|
||||
git tag -f -a $(IMAGE_VERSION)-latest -m "Version $(IMAGE_VERSION)-latest released"; \
|
||||
|
||||
_release:
|
||||
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG)
|
||||
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(COMMIT_ID)
|
||||
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)
|
||||
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-latest
|
||||
docker push $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG)
|
||||
|
|
Loading…
Reference in New Issue