Naming updates #2468
Workflow file for this run
This file contains 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: Build Data-Feeder | |
on: | |
push: | |
branches: [feature/*, dev, test] | |
env: | |
REGISTRY: ghcr.io | |
REGISTRY_USERNAME: ${{ secrets.CONTAINER_REGISTRY_USERNAME }} | |
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ env.REGISTRY }}/bcgov/api-services-portal/data-feeder | |
- name: Set DEPLOY_ID | |
run: | | |
echo '::set-output name=DEPLOY_ID::${{ steps.docker_meta.outputs.version }}' | |
echo '::set-output name=APP_VERSION::${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.version'] }}' | |
echo '::set-output name=APP_REVISION::${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.revision'] }}' | |
id: set-deploy-id | |
- name: Get deploy ID | |
run: echo "The DEPLOY_ID is ${{ steps.set-deploy-id.outputs.DEPLOY_ID }}" | |
- uses: actions/checkout@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.REGISTRY_USERNAME }} | |
password: ${{ env.REGISTRY_PASSWORD }} | |
- uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build | |
uses: docker/build-push-action@v2 | |
with: | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
context: feeds | |
file: feeds/Dockerfile | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
load: true | |
build-args: | | |
GITHUB_API_TOKEN=${{ secrets.CONTAINER_REGISTRY_PASSWORD }} | |
APP_VERSION=${{ steps.set-deploy-id.outputs.APP_VERSION }} | |
APP_REVISION=${{ steps.set-deploy-id.outputs.APP_REVISION }} | |
- name: Push | |
run: docker push ${{ steps.docker_meta.outputs.tags }} | |
- name: Install oc | |
uses: redhat-actions/oc-installer@v1 | |
with: | |
version: '4.6' | |
- name: Authenticate and set context | |
uses: redhat-actions/oc-login@v1 | |
with: | |
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }} | |
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} | |
# Disables SSL cert checking. Use this if you don't have the certificate authority data. | |
insecure_skip_tls_verify: true | |
namespace: ${{ env.OPENSHIFT_NAMESPACE }} | |
- name: 'Get Helm' | |
if: github.ref != 'refs/heads/dev' | |
run: | | |
curl -L -O https://get.helm.sh/helm-v3.4.2-linux-amd64.tar.gz | |
tar -xf helm-v3.4.2-linux-amd64.tar.gz | |
- name: 'Deploy Feeder' | |
if: github.ref != 'refs/heads/dev' | |
run: | | |
export PATH=$PATH:`pwd`/linux-amd64 | |
echo " | |
podAnnotations: | |
sha: $GITHUB_SHA | |
replicaCount: 1 | |
rollingUpdate: | |
maxUnavailable: 50% | |
maxSurge: 50% | |
image: | |
repository: ${{ env.REGISTRY }}/bcgov/api-services-portal/data-feeder | |
tag: ${{ steps.set-deploy-id.outputs.DEPLOY_ID }} | |
pullPolicy: Always | |
imagePullSecrets: | |
- name: dev-github-read-packages-creds | |
podSecurityContext: | |
fsGroup: ${{ secrets.RUNNING_UID_GID }} | |
securityContext: | |
runAsUser: ${{ secrets.RUNNING_UID_GID }} | |
containerPort: 6000 | |
serviceAccount: | |
create: false | |
name: asp-service-account | |
env: | |
TZ: | |
value: 'America/Los_Angeles' | |
LOG_FEEDS: | |
value: 'false' | |
WORKING_PATH: | |
value: '/tmp' | |
KONG_ADMIN_URL: | |
value: '${{ secrets.KONG_URL_DEV}}' | |
CKAN_URL: | |
value: 'https://catalog.data.gov.bc.ca' | |
PROM_URL: | |
value: 'http://prometheus-server' | |
DESTINATION_URL: | |
value: 'http://proto-asp-${{ steps.set-deploy-id.outputs.DEPLOY_ID }}-generic-api' | |
" > values.yaml | |
helm repo add bcgov http://bcgov.github.io/helm-charts | |
helm upgrade --install proto-asp-${{ steps.set-deploy-id.outputs.DEPLOY_ID }}-feeder -f values.yaml --history-max 3 bcgov/generic-api | |
- name: Authenticate to Gold and set context | |
if: github.ref == 'refs/heads/test' | |
uses: redhat-actions/oc-login@v1 | |
with: | |
openshift_server_url: ${{ secrets.OPENSHIFT_GOLD_SERVER }} | |
openshift_token: ${{ secrets.OPENSHIFT_GOLD_TOKEN }} | |
insecure_skip_tls_verify: true | |
namespace: ${{ secrets.OPENSHIFT_GOLD_TEST_NAMESPACE }} | |
- name: 'Restart Portal Feeder in Gold Test Namespace' | |
if: github.ref == 'refs/heads/test' | |
run: | | |
oc rollout restart deployment/bcgov-aps-portal-feeder-generic-api -n ${{ secrets.OPENSHIFT_GOLD_TEST_NAMESPACE }} | |