Unverified Commit 974b74d3 authored by Drew Bailey's avatar Drew Bailey
Browse files

check if website-docker-image job should run

Showing with 26 additions and 20 deletions
+26 -20
......@@ -455,16 +455,19 @@ jobs:
# There is an edge case that would cause an issue here - if dependencies are updated to an exact copy
# of a previous version, for example if packge-lock.json is reverted, we need to manually push the new
# image to the "latest" tag
IMAGE_TAG=$(cat website/Dockerfile website/package-lock.json | sha256sum | awk '{print $1;}')
echo "Using $IMAGE_TAG"
if ! curl https://hub.docker.com/v2/repositories/hashicorp/nomad-website/tags/$IMAGE_TAG -fsL > /dev/null; then
cd website/
docker build -t hashicorp/nomad-website:$IMAGE_TAG .
docker tag hashicorp/nomad-website:$IMAGE_TAG hashicorp/nomad-website:latest
docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
docker push hashicorp/nomad-website
else
echo "Dependencies have not changed, not building a new website docker image."
# Ignore job if running an enterprise build
if ! [ "$NOMAD_ENT_BUILD" = "true" ]; then
IMAGE_TAG=$(cat website/Dockerfile website/package-lock.json | sha256sum | awk '{print $1;}')
echo "Using $IMAGE_TAG"
if ! curl https://hub.docker.com/v2/repositories/hashicorp/nomad-website/tags/$IMAGE_TAG -fsL > /dev/null; then
cd website/
docker build -t hashicorp/nomad-website:$IMAGE_TAG .
docker tag hashicorp/nomad-website:$IMAGE_TAG hashicorp/nomad-website:latest
docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
docker push hashicorp/nomad-website
else
echo "Dependencies have not changed, not building a new website docker image."
fi
fi
name: Build Docker Image if Necessary
test-other:
......
......@@ -10,14 +10,17 @@ steps:
# There is an edge case that would cause an issue here - if dependencies are updated to an exact copy
# of a previous version, for example if packge-lock.json is reverted, we need to manually push the new
# image to the "latest" tag
IMAGE_TAG=$(cat website/Dockerfile website/package-lock.json | sha256sum | awk '{print $1;}')
echo "Using $IMAGE_TAG"
if ! curl https://hub.docker.com/v2/repositories/hashicorp/nomad-website/tags/$IMAGE_TAG -fsL > /dev/null; then
cd website/
docker build -t hashicorp/nomad-website:$IMAGE_TAG .
docker tag hashicorp/nomad-website:$IMAGE_TAG hashicorp/nomad-website:latest
docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
docker push hashicorp/nomad-website
else
echo "Dependencies have not changed, not building a new website docker image."
# Ignore job if running an enterprise build
if ! [ "$NOMAD_ENT_BUILD" = "true" ]; then
IMAGE_TAG=$(cat website/Dockerfile website/package-lock.json | sha256sum | awk '{print $1;}')
echo "Using $IMAGE_TAG"
if ! curl https://hub.docker.com/v2/repositories/hashicorp/nomad-website/tags/$IMAGE_TAG -fsL > /dev/null; then
cd website/
docker build -t hashicorp/nomad-website:$IMAGE_TAG .
docker tag hashicorp/nomad-website:$IMAGE_TAG hashicorp/nomad-website:latest
docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
docker push hashicorp/nomad-website
else
echo "Dependencies have not changed, not building a new website docker image."
fi
fi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment