Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature. change registry to harbor #48

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}}
${{env.REGISTRY}}/tks/${{env.SERVICE}}:${{env.TAG}}
Loading