Skip to content

Commit

Permalink
Modified workflows to trigger on push to master and tag
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledhikmat committed Jun 4, 2021
1 parent eb9041a commit 3fa128f
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 8 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Create a release

on:
push:
tags:
- '*'

env:
GQ_IMAGE_NAME: goqur-functions
GQ_IMAGE_VERSION: latest

jobs:
publish:
name: Dockerize and publish
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v2

- name: Build image
run: docker image build . --file Dockerfile --tag ${{ env.GQ_IMAGE_NAME }}

- name: Log into the Github package registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin

- name: Get the tag version
id: get_tag_version
run: |
# Strip git ref prefix from version
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Push image
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/${{ env.GQ_IMAGE_NAME }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Read the tag version from a previous step
VERSION=${{ steps.get_tag_version.outputs.VERSION }}
echo 'Tag version'
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
# Push to Github repository
docker tag ${{ env.GQ_IMAGE_NAME }} $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.get_tag_version.outputs.VERSION }}
release_name: Release ${{ steps.get_tag_version.outputs.VERSION }}
bodyFile: "RELEASE.md"
draft: false
prerelease: true
4 changes: 3 additions & 1 deletion .github/workflows/publish-2-docker-hub.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Publish goqur functions app Docker image to Docker Hub

on:
[workflow_dispatch]
push:
branches:
- main

env:
GQ_IMAGE_NAME: goqur-functions
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ The main search document is therefore `Ayah`. Please see [auran-ayahs.csv](auran
- Remember to disable the function app function to debug locally so it will not listen in the same blob storage
- .NET5 is not supported in all bindings and definitely it does not work with duarable functions. This is a sample out-of-process function app that shows how to inject [https://github.com/Azure/azure-functions-dotnet-worker/tree/main/samples/FunctionApp](https://github.com/Azure/azure-functions-dotnet-worker/tree/main/samples/FunctionApp). Here is what the documentation says anout .NET 5 support:

```
A .NET 5 function app runs in an isolated worker process. Instead of building a .NET library loaded by our host, you build a .NET console app that references a worker SDK.
> A .NET 5 function app runs in an isolated worker process. Instead of building a .NET library loaded by our host, you build a .> NET console app that references a worker SDK.
This brings immediate benefits: you have full control over the application’s startup and the dependencies it consumes. The new programming model also adds support for custom middleware which has been a frequently requested feature.
> This brings immediate benefits: you have full control over the application’s startup and the dependencies it consumes. The new programming model also adds support for custom middleware which has been a frequently requested feature.
While this isolated model for .NET brings the above benefits, it's worth worth noting there are some features you may have utilized in previous versions that aren't yet supported.
> While this isolated model for .NET brings the above benefits, it's worth worth noting there are some features you may have utilized in previous versions that aren't yet supported.
While the .NET isolated model supports most Azure Functions triggers and bindings, Durable Functions and rich types support are currently unavailable. Take a blob trigger for example, you are limited to passing blob content using data types that are supported in the out-of-process language worker model, which today are string, byte[] and POCO. You can still use Azure SDK types like CloudBlockBlob, you you'll need to instantiate the SDK in your function process.
```
> While the .NET isolated model supports most Azure Functions triggers and bindings, Durable Functions and rich types support are currently unavailable. Take a blob trigger for example, you are limited to passing blob content using data types that are supported in the out-of-process language worker model, which today are string, byte[] and POCO. You can still use Azure SDK types like CloudBlockBlob, you you'll need to instantiate the SDK in your function process.
## Microservices

Expand Down Expand Up @@ -125,11 +123,23 @@ Pass all the settings as env variables to the local image:
docker container run -it -p 8080:80 -e SEARCH_SVC_ENDPOINT=https://your-svs.search.windows.net -e SEARCH_SVC_API_KEY=your-key -e AzureWebJobsAzureWebJobsStorage="DefaultEndpointsProtocol=https;AccountName=your-name;AccountKey=your-key;EndpointSuffix=core.windows.net" -e AzureWebJobsStorage="DefaultEndpointsProtocol=https;AccountName=your-name;AccountKey=your-key;EndpointSuffix=core.windows.net" goqur-functions
```

Pass all the settings as env variables to the Docker hub image:
Pass all the settings as env variables to the Docker Hub registry image:
```
docker container run -it -p 8080:80 -e SEARCH_SVC_ENDPOINT=https://your-svs.search.windows.net -e SEARCH_SVC_API_KEY=your-key -e AzureWebJobsAzureWebJobsStorage="DefaultEndpointsProtocol=https;AccountName=your-name;AccountKey=your-key;EndpointSuffix=core.windows.net" -e AzureWebJobsStorage="DefaultEndpointsProtocol=https;AccountName=your-name;AccountKey=your-key;EndpointSuffix=core.windows.net" khaledhikmat/goqur-functions:latest
```

Pass all the settings as env variables to the Docker Github Package registery image. To do so, you need to login using a PAT (Personal Access Token). Here is how:
- Create a an access token that you can use from your github account 
- github -> settings-> Developer Settings -> tokens -> Personal access tokens 
- Make sure the token has Read and/or Write access to github registry 
- Then login to the registry: 1docker login docker.pkg.github.com --username <your_user_name> --password <generated_token_not_password>1
- Now pull/push to the registry should work 

```
docker login https://docker.pkg.github.com --username [email protected] --password ********
docker container run -it -p 8080:80 -e SEARCH_SVC_ENDPOINT=https://your-svs.search.windows.net -e SEARCH_SVC_API_KEY=your-key -e AzureWebJobsAzureWebJobsStorage="DefaultEndpointsProtocol=https;AccountName=your-name;AccountKey=your-key;EndpointSuffix=core.windows.net" -e AzureWebJobsStorage="DefaultEndpointsProtocol=https;AccountName=your-name;AccountKey=your-key;EndpointSuffix=core.windows.net" docker.pkg.github.com/khaledhikmat/goqur/goqur-functions:latest
```

Deploy to the default namespace. Make sure to update the env variables in `deployment.yml` for your environment:
```
kubectl apply -f k8s/functions/deployment.yml
Expand Down
4 changes: 4 additions & 0 deletions RELEASE.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This is an early alpha release that contains initial commits:
- CSV Parsing and chunking to bootstrap Azure Functions
- Parser and Indexer Azure Functions are more or less completed
- Overall familiarity with Github Actions

0 comments on commit 3fa128f

Please sign in to comment.