aws-samples / serverless-jenkins-on-aws-fargate

MIT No Attribution
123 stars 110 forks source link

update dockerfile and plugins #23

Closed azerioglan closed 1 year ago

azerioglan commented 2 years ago

Hello guys, I used your code to bring up fargate cluster. didn't find options to update docker image or list of plugins deployed first time. Documentation refers that need to create new task definition. But didn't figure out how to handle in code. simple deploy.sh diddn't help Appreciate for help or for directions

Thanks.

gabricc commented 2 years ago

Hi @azerioglan ! I had the same problem and I was able to solve it adding this trigger:

  triggers = {
    always_run = timestamp()
  }

Full example:

resource "null_resource" "build_docker_image" {
  triggers = {
     src_hash = file("${path.module}/docker/files/jenkins.yaml.tpl")
     always_run = timestamp()
  }
  depends_on = [null_resource.render_template]
  provisioner "local-exec" {
    command = <<EOF
docker login -u AWS -p ${data.aws_ecr_authorization_token.token.password} ${local.ecr_endpoint} && \
docker build -t ${aws_ecr_repository.jenkins_controller.repository_url}:latest ${path.module}/docker/ && \
docker push ${aws_ecr_repository.jenkins_controller.repository_url}:latest
EOF
  }
}
apogorielov commented 1 year ago

I've added trigger to the the main code to automatically rebuild instances, as well as list of updated plugins. Therefor I am closing this issue.