-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get the Jenkins worker image working (#178)
* Get the Jenkins worker image working This image hadn't been touched in years, and wasn't working. The original base image was using an unsupported version of Debian, so also switch to a more recent base image. Also use this opportunity to update Docker and AWS CLI tool. * Update README with latest version for jenkins-worker --------- Co-authored-by: MartinWheelerMT <[email protected]>
- Loading branch information
1 parent
3f0cb75
commit affec6f
Showing
3 changed files
with
27 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
# Jenkins worker image | ||
|
||
The files in this folder are used to create the image of a Jenkins worker for the Jenkin [amazon-ecs plugin](https://wiki.jenkins.io/display/JENKINS/Amazon+EC2+Container+Service+Plugin). | ||
The files in this folder are used to create the image of a Jenkins worker for the Jenkins [amazon-ecs plugin]. | ||
|
||
[amazon-ecs plugin]: https://wiki.jenkins.io/display/JENKINS/Amazon+EC2+Container+Service+Plugin | ||
|
||
Usage: | ||
1. Make sure you're logged into AWS with the appropriate credentials on your computer. | ||
2. Run these commands: | ||
```bash | ||
docker build -t temporary/jenkins-worker:latest . | ||
DOCKER_REGISTRY=nameOfDockerRegistry BUILD_TAG=buildTag packer build jenkins-worker.json | ||
``` | ||
2. Find out what the latest version of the jenkins-worker is by searching inside the `jenkins-worker` ECR registry. | ||
3. You can either replace the current build, if your change is low-risk, or create a new version allowing you | ||
the ability to rollback. | ||
4. Run these commands, specifying the version you wish to publish as. | ||
```shell | ||
VERSION=0.6 | ||
REGISTRY="$(aws sts get-caller-identity --query 'Account' --output text).dkr.ecr.eu-west-2.amazonaws.com" | ||
aws ecr get-login-password --region eu-west-2 | docker login -u AWS --password-stdin $REGISTRY | ||
docker buildx build --platform linux/amd64 --tag $REGISTRY/jenkins-worker:$VERSION --push . | ||
``` | ||
5. If you have specified a new version, you'll need to generate a new ECS Task Definition revision pointing to | ||
that image label. | ||
You can then specify that revision within Jenkins -> Configure System -> ECS agent template -> Task Definition Override, | ||
All subsequent Jenkins builds will use that new worker image, and if you want to rollback the previous revision | ||
can be placed within the Task Definition Overview box. |
This file was deleted.
Oops, something went wrong.