Skip to content

Commit

Permalink
azure login
Browse files Browse the repository at this point in the history
  • Loading branch information
maci3jka committed May 31, 2023
1 parent 53f1adf commit 9f0dbd7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/newRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2

- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Build and Push Container Image
uses: docker/build-push-action@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
dockerfile: Dockerfile
repository: ${{ secrets.REGISTRY_USER }}/${{ github.event.repository.name }}
registry: ${{ vars.REGISTRY_LOGIN_SERVER }}
repository: ${{ github.event.repository.name }}
username: ${{ vars.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
tag_with_ref: true
tag_with_sha: true

Expand All @@ -29,11 +32,11 @@ jobs:
run: echo "TAG_NAME=`echo ${GITHUB_REF#refs/tags/}`" >> $GITHUB_ENV
- name: Open PR in Environment Repository for new App Version
env:
ENV_REPO: ${{ github.event.repository.owner.name }}/example-environment
ENV_REPO: ${{ github.event.repository.owner.name }}/gitops-example-environment
uses: benc-uk/[email protected]
with:
workflow: New Application Version
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
inputs: '{"tag_name": "${{ env.TAG_NAME }}", "app_repo": "${{ github.event.repository.name }}", "image": "${{ github.event.repository.full_name }}:${{ env.TAG_NAME }}"}'
inputs: '{"tag_name": "${{ env.TAG_NAME }}", "app_repo": "${{ github.event.repository.name }}", "image": "${{ vars.REGISTRY_LOGIN_SERVER }}/${{ github.event.repository.name }}:${{ env.TAG_NAME }}"}'
ref: refs/heads/main
repo: ${{ env.ENV_REPO }}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN go build -o go-app
#FROM alpine:latest as certs
#RUN apk --no-cache add ca-certificates


FROM scratch
#COPY --from=certs /etc/ssl/certs/* /etc/ssl/certs/
ENTRYPOINT ["/go-app"]
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@ It runs a GitHub Workflow to build a container image on a new release, and trigg

## Requirements

- Secret: `AZURE_CREDENTIALS` of service principal with access to resources
- Secret: `PERSONAL_ACCESS_TOKEN` to trigger GitHub Workflows in the environment Repository
- Secret: `REGISTRY_USER` for the container image registry repository
- Secret: `REGISTRY_TOKEN` for the container image registry token
- Variable: `REGISTRY_USERNAME` for the container image registry repository
- Secret: `REGISTRY_PASSWORD` for the container image registry token
- Variable: `REGISTRY_LOGIN_SERVER` for the container image registry token

## Run the App
## Run the App locally

```bash
docker build -t app .
docker run -p 8080:8080 app
curl localhost:8080
```


### Connect to app on k8s cluster
```bash
kubectl port-forward svc/example-application 8080:8080
curl localhost:8080
```

0 comments on commit 9f0dbd7

Please sign in to comment.