Skip to content

Commit

Permalink
Merge pull request #1315 from alphagov/fix-inspire_mapper-harvest_obj…
Browse files Browse the repository at this point in the history
…ect_id

Fix inspire mapper harvest object
  • Loading branch information
kentsanggds authored Oct 4, 2024
2 parents 974b551 + ff0cfb0 commit d82c2a7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
type: choice
options:
- build_push
- build_push_dev
- build_only
push:
branches:
Expand Down Expand Up @@ -43,3 +44,10 @@ jobs:
APP: datagovuk_publish
ARCH: amd64
run: ./docker/build-image.sh
- name: Build and push dev images
if: ${{ inputs.buildType == 'build_push_dev' || github.ref == 'refs/heads/main' }}
env:
APP: datagovuk_publish
ARCH: amd64
DEV: "1"
run: ./docker/build-image.sh
2 changes: 1 addition & 1 deletion app/services/ckan/v26/inspire_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def call(package)
coupled_resource: package.get_extra("coupled-resource"),
dataset_reference_date: package.get_extra("dataset-reference-date"),
frequency_of_update: package.get_extra("frequency-of-update"),
harvest_object_id: package.get_extra("harvest_object_id") || package.get_harvest("harvest_object_id"),
harvest_object_id: package.get_harvest("harvest_object_id") || package.get_extra("harvest_object_id"),
harvest_source_reference: package.get_extra("harvest_source_reference"),
import_source: package.get_extra("import_source"),
metadata_date: package.get_extra("metadata-date", 10),
Expand Down
16 changes: 12 additions & 4 deletions docker/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ set -eux

build () {
if [ "${ARCH}" = "amd64" ]; then
docker build . -t "ghcr.io/alphagov/${APP}:${1}" -f "docker/Dockerfile"
docker build . -t "ghcr.io/alphagov/${APP}:${2}${1}" -f "docker/${2}Dockerfile"
else
docker buildx build --platform "linux/${ARCH}" . -t "ghcr.io/alphagov/${APP}:${1}" -f "docker/Dockerfile"
docker buildx build --platform "linux/${ARCH}" . -t "ghcr.io/alphagov/${APP}:${2}${1}" -f "docker/${2}Dockerfile"
fi
}

Expand All @@ -16,10 +16,18 @@ if [[ -n ${GH_REF:-} ]]; then
DOCKER_TAG="${GH_REF}"
fi

build "${DOCKER_TAG}"
if [[ -n ${DEV:-} ]]; then
build "${DOCKER_TAG}" "dev."
else
build "${DOCKER_TAG}" ""
fi

if [[ -n ${DRY_RUN:-} ]]; then
echo "Dry run; not pushing to registry"
else
docker push "ghcr.io/alphagov/${APP}:${DOCKER_TAG}"
if [[ -n ${DEV:-} ]]; then
docker push "ghcr.io/alphagov/${APP}:dev.${DOCKER_TAG}"
else
docker push "ghcr.io/alphagov/${APP}:${DOCKER_TAG}"
fi
fi

0 comments on commit d82c2a7

Please sign in to comment.