Remove unused call to extract-metadata GHA action #111
This file contains hidden or 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
name: CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
publish_docker_image_to_acr: | |
name: Publish Docker image to ACR | |
permissions: | |
id-token: write | |
contents: read | |
uses: HSLdevcom/jore4-tools/.github/workflows/shared-build-and-publish-docker-image.yml@shared-build-and-publish-docker-image-v1 | |
with: | |
docker_image_name: jore4-mssql-testdb | |
build_arm64_image: true | |
secrets: | |
azure_client_id: ${{ secrets.AZURE_CLIENT_ID }} | |
azure_tenant_id: ${{ secrets.AZURE_TENANT_ID }} | |
azure_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
test-docker-images: | |
name: verify that the docker images work | |
needs: publish_docker_image_to_acr | |
runs-on: ubuntu-24.04 | |
env: | |
SA_PASSWORD: "P@ssw0rd" | |
strategy: | |
matrix: | |
include: | |
# no test dumps are imported | |
- volumeMapping: "" | |
expectedOutput: | | |
name | |
-------------------------------------------------------------------------------------------------------------------------------- | |
jore3testdb | |
master | |
model | |
msdb | |
tempdb | |
(5 rows affected) | |
# test dumps are imported | |
- volumeMapping: ' -v "$(pwd)/docker-image-test-data:/data:ro"' | |
expectedOutput: | | |
name | |
-------------------------------------------------------------------------------------------------------------------------------- | |
bardb | |
foodb | |
jore3testdb | |
master | |
model | |
msdb | |
tempdb | |
(7 rows affected) | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Read Current MS SQL Docker Image | |
id: docker | |
shell: bash | |
run: | | |
echo mssql_docker_image="$(grep FROM Dockerfile | sed -E 's/FROM *([^ ]*)( AS.*)?/\1/g' | head -n 1)" >> "${GITHUB_OUTPUT}" | |
- name: Start up mssql docker container | |
run: | | |
# A custom network is used so that Docker containers can be referred with names instead of IPs | |
docker network rm hsl || true | |
docker network create -d bridge --subnet=10.240.0.0/24 hsl | |
docker network ls | |
docker run \ | |
-d \ | |
--rm \ | |
-p 1433:1433 \ | |
--name mssql \ | |
--hostname mssql \ | |
--network hsl \ | |
-e SA_PASSWORD="$SA_PASSWORD" \ | |
${{ matrix.volumeMapping }} \ | |
"${{ needs.publish_docker_image_to_acr.outputs.docker_image }}" | |
- name: | |
Verify that dockerized MSSQL database is up and can be connected to | |
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1 | |
with: | |
command: | |
'docker run | |
--network hsl | |
${{ steps.docker.outputs.mssql_docker_image }} | |
/opt/mssql-tools18/bin/sqlcmd | |
-C | |
-S mssql | |
-U sa | |
-P "$SA_PASSWORD" | |
-d master | |
-Q "SELECT ''OK'';"' | |
- name: | |
Verify that the proper sql dumps got imported (diff expected results) | |
env: | |
# query for listing all available database names | |
DB_QUERY: "SELECT name FROM master.sys.databases ORDER BY name;" | |
# A custom entrypoint needs to be used so that the output does not contain lines printed by | |
# the default entrypoint which would make the diff fail | |
run: | | |
docker run \ | |
--network hsl \ | |
--entrypoint /opt/mssql-tools18/bin/sqlcmd \ | |
${{ steps.docker.outputs.mssql_docker_image }} \ | |
-C \ | |
-S mssql \ | |
-U sa \ | |
-P "$SA_PASSWORD" \ | |
-d master \ | |
-Q "$DB_QUERY" \ | |
> dbresults.txt | |
echo "${{ matrix.expectedOutput }}" > expectedresults.txt | |
diff --ignore-all-space --ignore-blank-lines dbresults.txt expectedresults.txt |