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()
|
String currentTag = sh(script: 'git tag --points-at HEAD | head -n 1', returnStdout: true).trim()
|
||||||
// Retrieve default tag
|
// Retrieve default tag
|
||||||
String defaultTag = sh(returnStdout: true, script: 'git describe --always').trim()
|
String defaultTag = sh(returnStdout: true, script: 'git describe --always').trim()
|
||||||
container.buildAndPublishImage([
|
job('Building docker images') {
|
||||||
'imageName': 'reg.cadoles.com/pcaseiro/myapplication-standalone',
|
steps {
|
||||||
// Use current tag or default tag if not defined
|
shell('make')
|
||||||
'imageTag': defaultTag,
|
}
|
||||||
'dockerfile': './misc/images/myapplication-standalone/Dockerfile',
|
}
|
||||||
'dryRun': false
|
job('Publishing docker images') {
|
||||||
])
|
steps {
|
||||||
container.buildAndPublishImage([
|
shell('make release')
|
||||||
'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
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -2,9 +2,11 @@
|
||||||
# Makefile for Cadoles SP
|
# Makefile for Cadoles SP
|
||||||
################################
|
################################
|
||||||
|
|
||||||
IMAGE_REPO := reg.cadoles.com/cadoles
|
COMMIT_ID ?= $(shell git rev-parse --short --verify HEAD)
|
||||||
IMAGE_VERSION ?= 0.0.1
|
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
|
include main.mk
|
||||||
|
|
9
main.mk
9
main.mk
|
@ -28,12 +28,12 @@ define install_trivy
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define release_image
|
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:$(IMAGE_VERSION); \
|
||||||
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:latest ; \
|
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:latest ; \
|
||||||
docker push $(IMAGE_REPO)/$1:latest ; \
|
docker push $(IMAGE_REPO)/$1:latest ; \
|
||||||
docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION) ; \
|
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
|
endef
|
||||||
|
|
||||||
#list:
|
#list:
|
||||||
|
@ -57,9 +57,12 @@ release: ${IMAGES_DIR}/*
|
||||||
@for name in $(basename $(notdir $^)); do \
|
@for name in $(basename $(notdir $^)); do \
|
||||||
$(call release_image,$${name},base); \
|
$(call release_image,$${name},base); \
|
||||||
done;\
|
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:
|
_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)-$(IMAGE_VERSION)
|
||||||
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-latest
|
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)
|
docker push $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG)
|
||||||
|
|
Loading…
Reference in New Issue