Skip to content

Commit

Permalink
Fix image tag for pushing
Browse files Browse the repository at this point in the history
  • Loading branch information
dometto committed Oct 30, 2023
1 parent 99d2bc4 commit 196e386
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@ jobs:
- name: Build image
id: build-image
run: IMG=${{ matrix.images }} ./pack.sh docker
- name: Get image name # grep in the image directory's variables file to find the image tag to push
- name: Get image name and tag # grep in the image directory's variables file to find the image name/tag to push to
id: get-image-name
run: |
echo "image_name=`grep img_name ${{ matrix.images }}/variables.auto.pkrvars.hcl | awk '{print $3}'`" >> "$GITHUB_OUTPUT"
echo "image_tag=`grep img_tag ${{ matrix.images }}/variables.auto.pkrvars.hcl | awk '{print $3}'`" >> "$GITHUB_OUTPUT"
echo "docker_repo=`grep docker_repo ${{ matrix.images }}/variables.auto.pkrvars.hcl | awk '{print $3}'`" >> "$GITHUB_OUTPUT"
- name: Debug
run: echo ${{ steps.get-image-name.outputs.image_name }} ${{ steps.get-image-name.outputs.image_tag }}
run: echo ${{ steps.get-image-name.outputs.image_name }}
- name: Push image
run: docker push ${{ steps.get-image-name.outputs.image_name }}:${{ steps.get-image-name.outputs.image_tag }}
run: docker push ${{ steps.get-image-name.outputs.docker_repo }}
3 changes: 1 addition & 2 deletions ubuntu/focal/variables.auto.pkrvars.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
img_name = "src-test-workspace"
docker_repo = "ghcr.io/utrechtuniversity/src-test-workspace"
docker_repo = "ghcr.io/utrechtuniversity/src-test-workspace:ubuntu_focal"
img_tag = "ubuntu_focal"
docker_base_img = "ubuntu:focal"
vagrant_base_img = "ubuntu/focal64"
Expand Down
3 changes: 1 addition & 2 deletions ubuntu/focal_desktop/variables.auto.pkrvars.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
img_name = "src-test-workspace"
docker_repo = "ghcr.io/utrechtuniversity/src-test-workspace"
docker_repo = "ghcr.io/utrechtuniversity/src-test-workspace:ubuntu_focal-desktop"
img_tag = "ubuntu_focal-desktop"
docker_base_img = "ubuntu:focal"
vagrant_base_img = "ubuntu/focal64"
Expand Down
3 changes: 1 addition & 2 deletions ubuntu/jammy/variables.auto.pkrvars.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
img_name = "src-test-workspace"
docker_repo = "ghcr.io/utrechtuniversity/src-test-workspace"
docker_repo = "ghcr.io/utrechtuniversity/src-test-workspace:ubuntu_jammy"
img_tag = "ubuntu_jammy"
docker_base_img = "ubuntu:jammy"
vagrant_base_img = "ubuntu/jammy64"
Expand Down
4 changes: 2 additions & 2 deletions ubuntu/src-ubuntu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ variable "vagrant_base_img" {
}

variable "img_name" {
default = ""
default = "src-test-workspace"
type = string
}

Expand Down Expand Up @@ -209,7 +209,7 @@ build {

post-processor "docker-tag" {
except = ["vagrant.ubuntu"]
repository = "${var.docker_repo}:${var.img_tag}"
repository = var.docker_repo
}
post-processor "shell-local" {
except = ["vagrant.ubuntu"]
Expand Down

0 comments on commit 196e386

Please sign in to comment.