Add helm chart publication (#9)
* Add helm chart publication * Remove old cipublish path
This commit is contained in:
Родитель
e1ec9529c6
Коммит
57b22b89d0
|
@ -20,6 +20,9 @@ jobs:
|
|||
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
HELM_EXPERIMENTAL_OCI: 1 #enable OCI support
|
||||
HELM_VERSION_TO_INSTALL: 3.5.0 # version of HELM to install
|
||||
needs: build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -68,4 +71,26 @@ jobs:
|
|||
push: true
|
||||
tags: ${{ steps.add-dqe-image-tags.outputs.tags }}
|
||||
labels: ${{ steps.add-dqe-image-tags.outputs.labels }}
|
||||
file: ./dqe/Dockerfile
|
||||
file: ./dqe/Dockerfile
|
||||
- name: Install helm
|
||||
uses: Azure/setup-helm@v1
|
||||
with:
|
||||
version: ${{ env.HELM_VERSION_TO_INSTALL }} # default is latest
|
||||
- name: Log into MQE GHCR with helm
|
||||
run: |
|
||||
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io/${{ github.repository_owner }}/charts/pc-metadata-query-engine -u ${{ github.repository_owner }} --password-stdin
|
||||
- name: Save MQE chart locally
|
||||
run: |
|
||||
helm chart save ./deployment/helm/pc-metadata-query-engine ghcr.io/${{ github.repository_owner }}/charts/pc-metadata-query-engine:${{ github.sha }}
|
||||
- name: Publish MQE chart
|
||||
run: |
|
||||
helm chart push ghcr.io/${{ github.repository_owner }}/charts/pc-metadata-query-engine:${{ github.sha }}
|
||||
- name: Log into DQE GHCR with helm
|
||||
run: |
|
||||
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io/${{ github.repository_owner }}/charts/pc-data-query-engine -u ${{ github.repository_owner }} --password-stdin
|
||||
- name: Save DQE chart locally
|
||||
run: |
|
||||
helm chart save ./deployment/helm/pc-data-query-engine ghcr.io/${{ github.repository_owner }}/charts/pc-data-query-engine:${{ github.sha }}
|
||||
- name: Publish DQE chart
|
||||
run: |
|
||||
helm chart push ghcr.io/${{ github.repository_owner }}/charts/pc-data-query-engine:${{ github.sha }}
|
|
@ -37,9 +37,6 @@ As such, it is important to have the latest versions of docker and docker-compos
|
|||
At a minimum, running and developing locally requires docker-compose v1.27+.
|
||||
Confusing and hard to diagnose issues are to be expected if using an older version.
|
||||
|
||||
Actual (non-local) deployment of the project requires use of [cipublish](./scripts/cipublish), for which you'll also need the [azure command line client](https://docs.microsoft.com/en-us/cli/azure/) (installation instructions can be found [here](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)).
|
||||
Running [cipublish](./scripts/cipublish) and installing the azure command line client is *not* needed for local development.
|
||||
|
||||
### Running the PQE in a local development environment
|
||||
|
||||
This project uses a somewhat simplified variation on [scripts to rule them all](https://github.com/github/scripts-to-rule-them-all).
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
source bin/lib
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "${CI}" ]]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
function usage() {
|
||||
echo -n \
|
||||
"Usage: $(basename "$0") --token ACCESS_TOKEN --acr ACR_NAME --tag IMAGE_TAG
|
||||
Publishes helm charts. Done in the deploy container as Helm is set up.
|
||||
|
||||
--token: The ACR login token
|
||||
--acr: The name of the ACR (e.g. pccomponentstest)
|
||||
--tag: The tag to publish
|
||||
"
|
||||
}
|
||||
|
||||
###################
|
||||
# Parse arguments #
|
||||
###################
|
||||
|
||||
while [[ "$#" -gt 0 ]]; do case $1 in
|
||||
--token)
|
||||
ACCESS_TOKEN=${2}
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--acr)
|
||||
ACR_NAME=${2}
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--tag)
|
||||
IMAGE_TAG=${2}
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
usage
|
||||
exit 0
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
usage "Unknown parameter passed: $1"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac done
|
||||
|
||||
|
||||
if [[ -z ${ACCESS_TOKEN} ]]; then
|
||||
echo "Must pass in ACCESS_TOKEN with --token"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z ${ACR_NAME} ]]; then
|
||||
echo "Must pass in ACR_NAME with --acr"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z ${IMAGE_TAG} ]]; then
|
||||
echo "Must pass in ACCESS_TOKEN with --tag"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
|
||||
echo $ACCESS_TOKEN | helm registry login ${ACR_NAME}.azurecr.io -u 00000000-0000-0000-0000-000000000000 --password-stdin
|
||||
|
||||
# MQE
|
||||
|
||||
helm chart save \
|
||||
helm/pc-metadata-query-engine \
|
||||
${ACR_NAME}.azurecr.io/charts/pc-metadata-query-engine:${IMAGE_TAG}
|
||||
|
||||
helm chart push \
|
||||
${ACR_NAME}.azurecr.io/charts/pc-metadata-query-engine:${IMAGE_TAG}
|
||||
|
||||
# DQE
|
||||
|
||||
helm chart save \
|
||||
helm/pc-data-query-engine \
|
||||
${ACR_NAME}.azurecr.io/charts/pc-data-query-engine:${IMAGE_TAG}
|
||||
|
||||
helm chart push \
|
||||
${ACR_NAME}.azurecr.io/charts/pc-data-query-engine:${IMAGE_TAG}
|
||||
|
||||
# SAS
|
||||
|
||||
helm chart save \
|
||||
helm/pc-pqe-sasapi \
|
||||
${ACR_NAME}.azurecr.io/charts/pc-pqe-sasapi:${IMAGE_TAG}
|
||||
|
||||
helm chart push \
|
||||
${ACR_NAME}.azurecr.io/charts/pc-pqe-sasapi:${IMAGE_TAG}
|
||||
|
||||
# PQE Ingress
|
||||
|
||||
helm chart save \
|
||||
helm/pc-pqe-ingress \
|
||||
${ACR_NAME}.azurecr.io/charts/pc-pqe-ingress:${IMAGE_TAG}
|
||||
|
||||
helm chart push \
|
||||
${ACR_NAME}.azurecr.io/charts/pc-pqe-ingress:${IMAGE_TAG}
|
||||
|
||||
fi
|
|
@ -1,11 +0,0 @@
|
|||
services:
|
||||
publish:
|
||||
container_name: pc-mqe-deploy
|
||||
image: pc-mqe-deploy
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
- HELM_EXPERIMENTAL_OCI=1
|
||||
volumes:
|
||||
- .:/opt/src
|
|
@ -1,96 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
source scripts/env
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "${CI}" ]]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
function usage() {
|
||||
echo -n \
|
||||
"Usage: $(basename "$0") --acr ACR_NAME --tag IMAGE_TAG
|
||||
Publishes images for this project.
|
||||
|
||||
Must be logged in to the ACR (e.g. with az acr login -n ACR_NAME)
|
||||
|
||||
--acr: The name of the ACR to publish to
|
||||
"
|
||||
}
|
||||
|
||||
while [[ "$#" > 0 ]]; do case $1 in
|
||||
--acr)
|
||||
ACR_NAME=$2
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--tag)
|
||||
IMAGE_TAG=$2
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
usage
|
||||
exit 0
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
usage "Unknown parameter passed: $1"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac done
|
||||
|
||||
if [[ -z ${ACR_NAME} ]]; then
|
||||
echo "Must pass in ACR_NAME with --acr"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z ${IMAGE_TAG} ]]; then
|
||||
echo "Must pass in IMAGE_TAG with --tag"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IMAGES=(
|
||||
"${MQE_IMAGE_NAME}"
|
||||
"${DQE_IMAGE_NAME}"
|
||||
)
|
||||
|
||||
if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
|
||||
|
||||
# Publish images
|
||||
|
||||
for IMAGE_NAME in "${IMAGES[@]}"; do
|
||||
PUBLISHED_NAME=${ACR_NAME}.azurecr.io/${IMAGE_NAME}:${IMAGE_TAG}
|
||||
|
||||
echo "Publishing ${IMAGE_NAME}:${IMAGE_TAG} to ${PUBLISHED_NAME}"
|
||||
|
||||
docker tag ${IMAGE_NAME} ${PUBLISHED_NAME}
|
||||
docker push ${PUBLISHED_NAME}
|
||||
|
||||
done
|
||||
|
||||
# Publish charts
|
||||
|
||||
# Workaround issues with helm authentication.
|
||||
# See https://github.com/helm/helm/issues/6214#issuecomment-694441023
|
||||
ACCESS_TOKEN=$(az acr login --name ${ACR_NAME}.azurecr.io --expose-token --output tsv --query accessToken)
|
||||
|
||||
# Publish Helm charts in docker container;
|
||||
# Helm 3.7.0 was automatically installed in the
|
||||
# Azure Pipelines workers and broke publishing -
|
||||
# dockerizing this step lets us pin the Helm version.
|
||||
|
||||
docker-compose \
|
||||
-f deployment/docker-compose.publish.yml \
|
||||
build
|
||||
|
||||
docker-compose \
|
||||
-f deployment/docker-compose.publish.yml \
|
||||
run publish bin/publish \
|
||||
--token "${ACCESS_TOKEN}" \
|
||||
--acr "${ACR_NAME}" \
|
||||
--tag "${IMAGE_TAG}"
|
||||
|
||||
fi
|
Загрузка…
Ссылка в новой задаче