mirror of
https://github.com/zc2638/drone-k8s-plugin.git
synced 2026-06-14 05:12:24 +08:00
add action docker cache
This commit is contained in:
@@ -30,7 +30,15 @@ jobs:
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@master
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
@@ -39,15 +47,20 @@ jobs:
|
||||
password: ${{ secrets.DOCKER_SECRET }}
|
||||
|
||||
- name: Build and publish ${{ matrix.target.Dockerfile }}
|
||||
uses: docker/build-push-action@v2
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
file: ${{ matrix.target.Dockerfile }}
|
||||
platforms: linux/amd64,linux/arm64,linux/arm
|
||||
cache-from: type=gha,scope=${{ github.workflow }}
|
||||
cache-to: type=gha,mode=max,scope=${{ github.workflow }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||
tags: |
|
||||
zc2638/drone-k8s-plugin:${{ steps.prepare.outputs.full_tag_name }}
|
||||
zc2638/drone-k8s-plugin:${{ steps.prepare.outputs.latest_tag }}
|
||||
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
@@ -79,15 +79,15 @@ func run(cfg *Config, kubeClient kubernetes.Interface, dynamicClient dynamic.Int
|
||||
}
|
||||
mapping := restmapper.NewDiscoveryRESTMapper(gr)
|
||||
|
||||
logrus.Debug("start to apply resources from init templates")
|
||||
logrus.Debug("Start to apply resources from init templates")
|
||||
if err := applyResources(dynamicClient, mapping, initObjSet, cfg.Namespace); err != nil {
|
||||
return err
|
||||
}
|
||||
logrus.Debug("start to apply configmaps from config files")
|
||||
logrus.Debug("Start to apply configmaps from config files")
|
||||
if err := applyForConfig(kubeClient, cfg.GetConfigFiles()); err != nil {
|
||||
return err
|
||||
}
|
||||
logrus.Debug("start to apply resources from templates")
|
||||
logrus.Debug("Start to apply resources from templates")
|
||||
if err := applyResources(dynamicClient, mapping, objSet, cfg.Namespace); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -144,7 +144,7 @@ func applyResources(
|
||||
WithField("kind", gvk.Kind).
|
||||
WithField("namespace", objCopy.GetNamespace()).
|
||||
WithField("name", objCopy.GetName()).
|
||||
Info("Apply resource")
|
||||
Info("Apply Resource")
|
||||
|
||||
restMapping, err := mapping.RESTMapping(gvk.GroupKind(), gvk.Version)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user