Hi, yeah, the example is a little bit too simplistic, however with a bit more involved example, one can start seeing the benefits:
include Makefile.settings.PHONY:init build clean publish log jenkins slave# Jenkins settings
export DOCKER_GID?= 100
export JENKINS_USERNAME?= admin
export JENKINS_PASSWORD?= password
export JENKINS_SLAVE_VERSION?= 2.2
export JENKINS_SLAVE_LABELS?= DOCKER
# AWS settings
# The role to assume to inject temporary credentials into your Jenkins container
AWS_ROLE?=`aws configure get role_arn`# KMS encrypted password - the temporary credentials must possess kms:decrypt permissions for the key used to encrypt the credentials
export KMS_JENKINS_PASSWORD?=init:${INFO}"Creating volumes..."@ docker volume create --name=jenkins_home
build:${INFO}"Building image..."@ docker-compose build --pull${INFO}"Build complete"jenkins:init@$(if$(and $(AWS_PROFILE),$(KMS_JENKINS_PASSWORD)),$(call assume_role,$(AWS_ROLE)),)${INFO}"Starting Jenkins..."${INFO}"This may take some time..."@ docker-compose up -d jenkins
@$(call check_service_health,$(RELEASE_ARGS),jenkins)${INFO}"Jenkins is running at http://$(DOCKER_HOST_IP):$(call get_port_mapping,jenkins,8080)..."publish:${INFO}"Publishing images..."@ docker-compose push
${INFO}"Publish complete"slave:${INFO}"Checking Jenkins is healthy..."@$(if$(and $(AWS_PROFILE),$(KMS_JENKINS_PASSWORD)),$(call assume_role,$(AWS_ROLE)),)@$(call check_service_health,$(RELEASE_ARGS),jenkins)${INFO}"Starting $(SLAVE_COUNT) slave(s)..."@ docker-compose up -d--scale jenkins-slave=$(SLAVE_COUNT)${INFO}"$(SLAVE_COUNT) slave(s) running"clean:${INFO}"Stopping services..."@ docker-compose down -v||true${INFO}"Services stopped"destroy:clean${INFO}"Deleting jenkins home volume..."@ docker volume rm-f jenkins_home
${INFO}"Deletion complete"log:${INFO}"Streaming Jenkins logs - press CTRL+C to exit..."@ docker-compose logs -f jenkins
what I see is that makefiles are less used with some languages, but are still quite heavily used with others.
Though I agree that I also haven't seen complex makefile in a while, but that is probably because more and more languages have their own tooling.
JS: npm scripts, gulp, grunt, etc.
C#: Powershell (Invoke!), maybe Cake
F#: FAKE
Rust: cargo custom tasks
JVM languages had their own for a long time also: sbt (Scala), gradle (a lot of JVM langs)
Python: Fabric, but here I've seen a lot of makefiles :-)
Ruby: Rake
Elixir: mix with custom tasks
Go: maybe Task, but here I've also seen quite a lot of makefiles
Can't tell for the rest, these are the ones I am familiar with.
The code in this file is probably a bit more involved and harder to decipher, but it is just parsing functions really.
To get useful data from docker and/or env variables
Hi, yeah, the example is a little bit too simplistic, however with a bit more involved example, one can start seeing the benefits:
what I see is that makefiles are less used with some languages, but are still quite heavily used with others.
Though I agree that I also haven't seen complex makefile in a while, but that is probably because more and more languages have their own tooling.
Can't tell for the rest, these are the ones I am familiar with.
Great content, Thank you.
What do you have inside your Makefile.settings?
Hi,
The code in this file is probably a bit more involved and harder to decipher, but it is just parsing functions really.
To get useful data from docker and/or env variables
Makefile.settings:Just the first 3 lines are worth it
Small updates:
PYTHON:
Fabric was used for this in it's 1.x version.
Since version 2.0 Fabric was split essentially into 2 packages with separate functionalities:
GENERIC:
There is now another tool, that is generic and can be used for many languages, it is even cross-platform
Haven't used it though, in most cases I go with language native solution and if there is none, I usually either: