Skip to content

Commit

Permalink
adding project initilization workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudzilla-launcher-lens-rc[bot] authored Sep 2, 2024
1 parent 54bfd42 commit e132ea0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/init-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch:

env:
IMAGE_PREFIX: registry.cloudzilla.ai/rc-project-566ca024/
IMAGE_PREFIX: registry.cloudzilla.ai/rc-project-0ad4a728/

jobs:
build-push:
Expand All @@ -22,7 +22,7 @@ jobs:
uses: docker/login-action@v3
with:
registry: https://registry.cloudzilla.ai/
username: 'robot$rc-project-566ca024+imageuser'
username: 'robot$rc-project-0ad4a728+imageuser'
password: '${{ secrets.DOCKER_PASSWORD }}'

- name: downcase REPO
Expand All @@ -36,6 +36,13 @@ jobs:
with:
images: ${{ env.IMAGE_PREFIX }}${{ env.IMAGE_NAME }}

- name: Put down .env file
run: |
echo "writing .env file..."
echo "# This file is generated or updated by the cloudzilla deploy workflow" >> .env
# remove duplicates keeping the items at the bottom of the file
tac .env | awk -F'=' '!seen[$1]++' | tac > .env.tmp2 && mv .env.tmp2 .env
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
Expand All @@ -49,7 +56,7 @@ jobs:
SECTION_K8S_API_URL: '${{ secrets.SECTION_K8S_API_URL }}'
SECTION_API_TOKEN: '${{ secrets.SECTION_API_TOKEN }}'
DOCKER_SERVER: 'registry.cloudzilla.ai'
DOCKER_USERNAME: 'robot$rc-project-566ca024+imageuser'
DOCKER_USERNAME: 'robot$rc-project-0ad4a728+imageuser'
DOCKER_PASSWORD: '${{ secrets.DOCKER_PASSWORD }}'
FULL_IMAGE_WITH_TAG: '${{ env.DOCKER_METADATA_OUTPUT_TAGS }}'
POD_NAME: '${{ env.IMAGE_NAME }}'
Expand All @@ -66,11 +73,12 @@ jobs:
main() {
setCluster
kubectl create secret generic console-project-env-secret --from-env-file=${GITHUB_WORKSPACE}/.env --dry-run=client -o yaml | kubectl apply -f -
kubectl create secret docker-registry regcred --docker-server="${DOCKER_SERVER}" --docker-username="${DOCKER_USERNAME}" --docker-password="${DOCKER_PASSWORD}" --dry-run=client -o yaml | kubectl apply -f -
envsubst '$FULL_IMAGE_WITH_TAG $POD_NAME' < ${GITHUB_WORKSPACE}/k8s/deploy.yaml | kubectl apply -f -
kubectl apply -f ${GITHUB_WORKSPACE}/k8s/ingress-upstream.yaml
envsubst '$FULL_IMAGE_WITH_TAG $POD_NAME' < ${GITHUB_WORKSPACE}/k8s/deploy.yaml | kubectl apply -f -
kubectl rollout restart deployment "section-project-deployment"
}
setCluster() {
Expand Down
3 changes: 3 additions & 0 deletions k8s/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ spec:
- name: console-project
image: $FULL_IMAGE_WITH_TAG
imagePullPolicy: Always
envFrom:
- secretRef:
name: console-project-env-secret
resources:
limits:
cpu: 2000m
Expand Down

0 comments on commit e132ea0

Please sign in to comment.