Closed SvenC56 closed 4 years ago
Hi! You are using an older version of the plugin, I wonder if that's my fault? Are you pulling it from Docker? If so what version are you using?!
Hi, if you're pulling from the Docker Hub, it's absolutely my fault.
From docker.io: latest Last updated 7 months ago by danielgormly
Ironically I don't have CI on this project!
I've just pushed 0.2.0
to Docker Hub and tagged it with latest
too.
It's good practice to fix the plugin version i.e. danielgormly/drone-plugin-kube:0.2.0
But if you do use just danielgormly/drone-plugin-kube
you may have to also use the attribute pull: always
for your next push, to ensure it actually downloads the latest plugin. You'll see the version number in the logs either way though.
Let me know how you go and I'll close the issue if it works
image: registry.example.com/ti/wiki:{{ build.number }}
You can't use this directly in the kubernetes yaml file! You have to pass it through to drone-plugin-kube via .drone.yml... e.g.:
- name: whatever
image: danielgormly/drone-plugin-kube:0.2.0
settings:
build_number: ${build.number}
then access it like {{build_number}}
inside the kubernetes yaml as you've done above
This plugin can only read one .yaml and change one resource at a time. I'm not sure if you're only using one kubernetes yaml scaffold? But you'd need to run the plugin one time for each resource i.e.:
- name: service
image: danielgormly/drone-plugin-kube:0.2.0
...
- name: deployment
image: danielgormly/drone-plugin-kube:0.2.0
...
- name: service
image: danielgormly/drone-plugin-kube:0.2.0
Hi many thanks for the fast reply. So I adapted the settings with your help and the issue with the build_number
is working now. Now I get this error if I deploy the service:
danielgormly/drone-plugin-kube@0.0.2 https://github.com/danielgormly/drone-plugin-kube
2020/04/03 11:00:40 ⛔️ Fatal error:
⛔️ This plugin doesn't support that resource type
These are my current settings:
kind: pipeline
type: kubernetes
name: default
steps:
- name: Build Image
image: node
commands:
- yarn global add vuepress
- yarn install
- yarn docs:build
- name: "Docker: build & push"
image: plugins/docker:18.09.1
settings:
registry: registry.example.com
repo: registry.example.com/ti/wiki
dockerfile: Dockerfile
tag: ["latest", "v1.${DRONE_BUILD_NUMBER}"]
username:
from_secret: docker_username
password:
from_secret: docker_password
- name: Deploy K8s - Workload
image: danielgormly/drone-plugin-kube:0.0.2
settings:
build_number: ${DRONE_BUILD_NUMBER}
namespace: wiki
template: deployment.yaml
ca:
from_secret: k8s_cert
server:
from_secret: k8s_server
token:
from_secret: k8s_token
- name: Deploy K8s - Service
image: danielgormly/drone-plugin-kube:0.0.2
settings:
namespace: wiki
template: service.yaml
ca:
from_secret: k8s_cert
server:
from_secret: k8s_server
token:
from_secret: k8s_token
- name: Deploy K8s - Ingress
image: danielgormly/drone-plugin-kube:0.0.2
settings:
namespace: wiki
template: ingress.yaml
ca:
from_secret: k8s_cert
server:
from_secret: k8s_server
token:
from_secret: k8s_token
service.yaml
apiVersion: v1
kind: Service
metadata:
name: wiki-http
namespace: wiki
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: wiki
type: ClusterIP
Oh hahah..... Sorry
not danielgormly/drone-plugin-kube:0.0.2
but danielgormly/drone-plugin-kube:0.2.0
I'm terrible
Yes I also overlooked it. It's working now with 0.2.0
🙂 . Thank you and have a nice weekend!
I filed #9 to see if we can get the images we can find on the docker hub with the releases tags and the log messages.
Thank you all!
Hello
I tried to make use of the template referencing but it is not working for me. I get this error in the log. It seems that the
build.number
value is empty.