This commit is contained in:
zhangwei 2024-11-11 15:21:52 +08:00
commit 08d7ef9317
2 changed files with 19 additions and 10 deletions

View File

@ -38,17 +38,26 @@ jobs:
username: ${{ secrets.ALIYUN_USERNAME }}
password: ${{ secrets.ALIYUN_PASSWORD }}
- name: Get commit ID and build time
id: get_tags
run: |
echo "::set-output name=build_time::$(date +'%Y%m%d%H%M%S')"
- name: Build and push multi-arch image
run: |
docker buildx build --platform linux/amd64,linux/arm64 -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} --push .
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get_tags.outputs.build_time }} \
--push .
- name: Set up SSH key
- name: Set up Kubernetes CLI
uses: azure/setup-kubectl@v1
- name: Configure kubeconfig
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config
- name: SSH to remote server and restart deployment
if: github.event_name != 'pull_request'
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "kubectl rollout restart deployment ${{ secrets.SSH_DEPLOYMENT }} -n ${{ secrets.SSH_NAMESPACE }}"
- name: Restart Deployment
run: kubectl rollout restart deployment ${{ secrets.SSH_DEPLOYMENT }}

View File

@ -45,7 +45,7 @@ func (l *CenterResourcesLogic) CenterResources() (*types.CenterResourcesResp, er
}
for _, centerIndex := range centersIndex {
// Query the types of resource centers
tx := l.svcCtx.DbEngin.Raw("select name,type as CenterType from t_adapter where id = ?", centerIndex.Id).Scan(&centerIndex)
tx := l.svcCtx.DbEngin.Raw("select id,name,type as CenterType from t_adapter where id = ?", centerIndex.Id).Scan(&centerIndex)
if tx.Error != nil {
return nil, tx.Error
}