Skip to content

Commit

Permalink
feature. change registry to harbor
Browse files Browse the repository at this point in the history
  • Loading branch information
taekyu.kang committed Nov 11, 2024
1 parent 0584c49 commit 890039a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and deploy
name: Build And Deploy
on:
push:
branches:
Expand All @@ -10,6 +10,7 @@ on:
env:
SERVICE: tks-batch
TAG: ${{github.sha}}
REGISTRY: harbor.taco-cat.xyz

jobs:
build-deploy:
Expand All @@ -24,16 +25,17 @@ jobs:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
registry: ${{env.REGISTRY}}
username: ${{secrets.HARBOR_USERNAME}}
password: ${{secrets.HARBOR_SECRET}}

- name: Build and Push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: |
sktcloud/${{env.SERVICE}}:${{env.TAG}}
${{env.REGISTRY}}/tks/${{env.SERVICE}}:${{env.TAG}}
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v1
Expand All @@ -46,12 +48,12 @@ jobs:
git clone "https://${{secrets.BOT_GITHUB_TOKEN}}@github.com/openinfradev/cicd-manifests.git"
if [[ ${{github.ref}} == *"develop"* ]]; then
( cd cicd-manifests/${SERVICE}/overlay/development && kustomize edit set image docker.io/sktcloud/${SERVICE}:${TAG} && git add kustomization.yaml )
( cd cicd-manifests/${SERVICE}/overlay/development && kustomize edit set image ${REGISTRY}/tks/${SERVICE}:${TAG} && git add kustomization.yaml )
elif [[ ${{github.ref}} == *"release"* ]]; then
( cd cicd-manifests/${SERVICE}/overlay/ft && kustomize edit set image docker.io/sktcloud/${SERVICE}:${TAG} && git add kustomization.yaml )
( cd cicd-manifests/${SERVICE}/overlay/ft && kustomize edit set image ${REGISTRY}/tks/${SERVICE}:${TAG} && git add kustomization.yaml )
elif [[ ${{github.ref}} == *"main"* ]]; then
( cd cicd-manifests/${SERVICE}/overlay/cicd && kustomize edit set image docker.io/sktcloud/${SERVICE}:${TAG} && git add kustomization.yaml )
( cd cicd-manifests/${SERVICE}/overlay/prd && kustomize edit set image docker.io/sktcloud/${SERVICE}:${TAG} && git add kustomization.yaml )
( cd cicd-manifests/${SERVICE}/overlay/cicd && kustomize edit set image ${REGISTRY}/tks/${SERVICE}:${TAG} && git add kustomization.yaml )
( cd cicd-manifests/${SERVICE}/overlay/prd && kustomize edit set image ${REGISTRY}/tks/${SERVICE}:${TAG} && git add kustomization.yaml )
fi
cd cicd-manifests
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
name: Build only
name: Build Image
on:
pull_request:
pull_request_target:
branches:
- main
- develop
- release

env:
SERVICE: tks-batch
TAG: ${{github.sha}}
REGISTRY: harbor.taco-cat.xyz

jobs:
build-and-push-image:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -16,18 +21,19 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{env.REGISTRY}}
username: ${{secrets.HARBOR_USERNAME}}
password: ${{secrets.HARBOR_SECRET}}

- name: build image
id: docker_build
uses: docker/build-push-action@v2
with:
push: false
tags: |
sktcloud/${{env.SERVICE}}:${{env.TAG}}
tks/${{env.SERVICE}}:${{env.TAG}}

0 comments on commit 890039a

Please sign in to comment.