Skip to content

Commit

Permalink
chore: cd
Browse files Browse the repository at this point in the history
  • Loading branch information
guesant committed Nov 28, 2024
1 parent f8ba5ce commit 951c912
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 78 deletions.
42 changes: 42 additions & 0 deletions .devops/api-service/values.common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
applicationName: ladesa-ro-sso

service:
enabled: true
type: NodePort
ports:
- name: web-service
port: 80
targetPort: web-port

deployment:
enabled: false

replicas: 1

containerSecurityContext: false

ports:
- containerPort: 3000
name: web-port

readinessProbe:
httpGet:
path: /health/
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /health/
port: 3000
initialDelaySeconds: 10
periodSeconds: 15
startupProbe:
httpGet:
path: /health/
port: 3000
failureThreshold: 30
periodSeconds: 10

ingress:
enabled: false
99 changes: 99 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Continuos Deployment

on:
push:
branches:
- production
- development

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
cd_build_push_api:
name: "Build and Push (api service)"
runs-on: ubuntu-latest

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-build
cancel-in-progress: false

environment:
name: ${{ github.ref_name == 'development' && 'development' || 'production' }}

steps:
- uses: ladesa-ro/esteira-ci-cd/actions/prepare-images-builder@main
with:
setup-qemu: "false"
push-image: "true"
push-image-registry-url: ${{ secrets.REGISTRY_URL }}
push-image-registry-username: ${{ secrets.REGISTRY_USERNAME }}
push-image-registry-token: ${{ secrets.REGISTRY_TOKEN }}

- name: Build and push @ladesa-ro/api.service
uses: ladesa-ro/esteira-ci-cd/actions/image-build-push@main
with:
image-tag: ${{ github.ref_name }}
image-name: ${{ vars.IMAGE_NAME_SERVICE }}

build-image: "true"
build-target-tag: "api-service"

push-image: "true"
push-image-registry-url: ${{ secrets.REGISTRY_URL }}

cd_build_push_docs:
name: "Build and Push - docs"
runs-on: ubuntu-latest

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-build
cancel-in-progress: false

if: github.ref_name == 'development'

environment:
name: docs

steps:
- uses: ladesa-ro/esteira-ci-cd/actions/prepare-images-builder@main
with:
setup-qemu: "false"
push-image: "true"
push-image-registry-url: ${{ secrets.REGISTRY_URL }}
push-image-registry-username: ${{ secrets.REGISTRY_USERNAME }}
push-image-registry-token: ${{ secrets.REGISTRY_TOKEN }}

- name: Build and push @ladesa-ro/api-client-fetch-docs
uses: ladesa-ro/esteira-ci-cd/actions/image-build-push@main
with:
image-tag: ${{ github.ref_name }}
image-name: ${{ vars.IMAGE_NAME_DOCS_NPM_API_CLIENT_FETCH }}

build-image: "true"
build-target-tag: "npm-api-client-fetch-docs"

push-image: "true"
push-image-registry-url: ${{ secrets.REGISTRY_URL }}

cd_deploy_api:
name: Deploy to Cluster

runs-on: deploy
needs: [cd_build_push_api]

environment:
name: ${{ github.ref_name == 'development' && 'development' || 'production' }}
url: ${{ vars.DEPLOY_URL }}

steps:
- uses: actions/checkout@v4

- uses: ladesa-ro/esteira-ci-cd/actions/deploy-k8s-stakater-application@main
with:
helm-values: ${{ vars.DEPLOY_HELM_VALUES }}
deployment: ${{ vars.K8S_DEPLOYMENT }}
namespace: ${{ vars.K8S_NAMESPACE }}
helm-release-name: ${{ vars.K8S_DEPLOYMENT }}
helm-release-extra-options: "--values=./.devops/api-service/values.common.yml"
77 changes: 0 additions & 77 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,10 @@ jobs:
security-events: write

steps:
# - uses: actions/create-github-app-token@v1
# id: app-token
# with:
# app-id: ${{ secrets.LADESA_BOT_ID }}
# private-key: ${{ secrets.LADESA_BOT_SECRET }}

# - name: Get GitHub App User ID
# id: get-user-id
# run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
# env:
# GH_TOKEN: ${{ steps.app-token.outputs.token }}

# - run: |
# git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
# git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'

- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
# token: ${{ steps.app-token.outputs.token }}

- name: Install
uses: ./.github/actions/prepare/install
Expand Down Expand Up @@ -79,66 +62,6 @@ jobs:
- name: print outputs (for debug purposes only)
run: echo '${{ toJSON(needs.release.outputs) }}'

cd_build_push:
name: "Build and Push"
runs-on: ubuntu-latest

environment:
name: ${{ github.ref_name == 'development' && 'development' || 'production' }}

steps:
- uses: ladesa-ro/esteira-ci-cd/actions/prepare-images-builder@main
with:
setup-qemu: "false"
push-image: "true"
push-image-registry-url: ${{ secrets.REGISTRY_URL }}
push-image-registry-username: ${{ secrets.REGISTRY_USERNAME }}
push-image-registry-token: ${{ secrets.REGISTRY_TOKEN }}

- name: Build and push @ladesa-ro/api.service
uses: ladesa-ro/esteira-ci-cd/actions/image-build-push@main
with:
image-tag: ${{ github.ref_name }}
image-name: ${{ vars.IMAGE_NAME_SERVICE }}

build-image: "true"
build-target-tag: "api-service"

push-image: "true"
push-image-registry-url: ${{ secrets.REGISTRY_URL }}

- name: Build and push @ladesa-ro/api-client-fetch-docs
uses: ladesa-ro/esteira-ci-cd/actions/image-build-push@main
with:
image-tag: ${{ github.ref_name }}
image-name: ${{ vars.IMAGE_NAME_DOCS_NPM_API_CLIENT_FETCH }}

build-image: "true"
build-target-tag: "npm-api-client-fetch-docs"

push-image: "true"
push-image-registry-url: ${{ secrets.REGISTRY_URL }}

# cd_deploy:
# name: Deploy to Cluster

# runs-on: deploy
# needs: [cd_build_push]

# environment:
# name: ${{ github.ref_name == 'development' && 'development' || 'production' }}
# url: ${{ vars.DEPLOY_URL }}

# steps:
# - uses: actions/checkout@v4

# - uses: ladesa-ro/esteira-ci-cd/actions/deploy-k8s-stakater-application@main
# with:
# helm-values: ${{ vars.DEPLOY_HELM_VALUES }}
# deployment: ${{ vars.K8S_DEPLOYMENT }}
# namespace: ${{ vars.K8S_NAMESPACE }}
# helm-release-name: ${{ vars.K8S_DEPLOYMENT }}

ci_npm:
name: Publish to the NPM registry
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG GIT_COMMIT_HASH
ARG PATH_SOURCE=/tmp/ldsa/.source
ARG PATH_LOCAL_BUILDS=/tmp/ldsa/.builds
ARG NX_CACHE_DIRECTORY=/tmp/ldsa/.cache/nx
ARG PATH_FINAL_BUILDS=/usr/local/ladesa-ro/services/
ARG PATH_FINAL_BUILDS=/usr/local/ladesa-ro/services
ARG NX_SOCKET_DIR=/tmp/nx-tmp

# ========================================
Expand Down

0 comments on commit 951c912

Please sign in to comment.