Skip to content

Commit

Permalink
${{ env.WORKLOAD_NAME }}
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieu-benoit authored Sep 1, 2023
1 parent bca2a41 commit 5fdc531
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/open-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
SCORE_COMPOSE_VERSION: 'latest'
SCORE_HELM_VERSION: 'latest'
SCORE_HUMANITEC_VERSION: 'latest'
WORKLOAD_NAME: my-sample-app
jobs:
build-run-test-push:
runs-on: ubuntu-latest
Expand All @@ -30,10 +31,10 @@ jobs:
score-compose run \
--build app/ \
-f score/score.yaml \
-o ${{ vars.APP_NAME }}-compose.yaml
-o ${{ env.WORKLOAD_NAME }}-compose.yaml
cat <<EOF > base-compose.yaml
services:
my-sample-app:
${{ env.WORKLOAD_NAME }}:
image: ${{ env.IMAGE_NAME }}:${{ env.ENVIRONMENT_ID }}
read_only: true
cap_drop:
Expand All @@ -43,7 +44,7 @@ jobs:
- name: build & run container
run: |
docker compose \
-f ${{ vars.APP_NAME }}-compose.yaml \
-f ${{ env.WORKLOAD_NAME }}-compose.yaml \
-f base-compose.yaml \
up \
-d \
Expand All @@ -70,30 +71,30 @@ jobs:
run: |
score-helm run \
-f score/score.yaml \
-o ${{ vars.APP_NAME }}-values.yaml
-o ${{ env.WORKLOAD_NAME }}-values.yaml
- name: helm install
id: helm-install
run: |
helm repo add \
score-helm-charts \
https://score-spec.github.io/score-helm-charts
helm install \
${{ vars.APP_NAME }} \
${{ env.WORKLOAD_NAME }} \
score-helm-charts/workload \
--values ${{ vars.APP_NAME }}-values.yaml \
--set containers.${{ vars.APP_NAME }}.image.name=${{ env.IMAGE_NAME }}:${{ env.ENVIRONMENT_ID }} \
--values ${{ env.WORKLOAD_NAME }}-values.yaml \
--set containers.${{ env.WORKLOAD_NAME }}.image.name=${{ env.IMAGE_NAME }}:${{ env.ENVIRONMENT_ID }} \
--wait \
--timeout=30s
kubectl wait \
--for=condition=available \
--timeout=30s \
deployment/${{ vars.APP_NAME }}
deployment/${{ env.WORKLOAD_NAME }}
- name: catch helm install errors
if: ${{ failure() && steps.helm-install.outcome == 'failure' }}
run: |
kubectl get events
kubectl logs \
-l app.kubernetes.io/name=${{ vars.APP_NAME }}
-l app.kubernetes.io/name=${{ env.WORKLOAD_NAME }}
- name: authenticate to google cloud
uses: google-github-actions/auth@v1
with:
Expand Down Expand Up @@ -174,7 +175,7 @@ jobs:
--env ${{ env.ENVIRONMENT_ID }} \
-f score/score.yaml \
--extensions score/humanitec.score.yaml \
--property containers.${{ vars.APP_NAME }}.image=${{ env.IMAGE_NAME }}@${IMAGE_DIGEST} \
--property containers.${{ env.WORKLOAD_NAME }}.image=${{ env.IMAGE_NAME }}@${IMAGE_DIGEST} \
| tee score_output.json
- name: wait for deployment
run: |
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/push-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ on:
- 'v*'
env:
IMAGE_TAG: ${{ github.ref_name }}
IMAGE_NAME: ${{ secrets.REGISTRY_LOCATION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ secrets.REGISTRY_NAME }}/${{ vars.APP_NAME }}
IMAGE_NAME: ${{ secrets.REGISTRY_LOCATION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ secrets.REGISTRY_NAME }}/my-sample-app
ENVIRONMENT_ID: development
SCORE_HUMANITEC_VERSION: 'latest'
WORKLOAD_NAME: my-sample-app
jobs:
build-push:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -53,11 +54,11 @@ jobs:
run: |
docker tag \
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} \
ghcr.io/${{ github.repository_owner }}/${{ vars.APP_NAME }}:latest
ghcr.io/${{ github.repository_owner }}/${{ env.WORKLOAD_NAME }}:latest
- name: push container in ghcr
run: |
docker push \
ghcr.io/${{ github.repository_owner }}/${{ vars.APP_NAME }}:latest
ghcr.io/${{ github.repository_owner }}/${{ env.WORKLOAD_NAME }}:latest
deploy-humanitec:
needs: build-push
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -118,7 +119,7 @@ jobs:
--env ${{ env.ENVIRONMENT_ID }} \
-f score/score.yaml \
--extensions score/humanitec.score.yaml \
--property containers.${{ vars.APP_NAME }}.image=${{ env.IMAGE_NAME }}@${IMAGE_DIGEST} \
--property containers.${{ env.WORKLOAD_NAME }}.image=${{ env.IMAGE_NAME }}@${IMAGE_DIGEST} \
| tee score_output.json
- name: wait for deployment
run: |
Expand Down

0 comments on commit 5fdc531

Please sign in to comment.