plugins/docker failed to resolve Keycloak hostname?
2021-01-27
After integrating Docker registry with Keycloak, the publishing step failed to authenticate with Docker Registry.
The full error message is:
time="2021-01-26T13:44:18.485121053Z" level=error msg="Handler for POST /v1.40/auth returned error: Get https://docker.domain.com/v2/: Get https://sso.domain.com/auth/realms/application/protocol/docker-v2/auth?account=******&client_id=docker&offline_token=true&service=aws-docker-registry: dial tcp: lookup sso.domain.com on 127.0.0.11:53: no such host"
sso.domain.com is a local hostname which can be resolved on the host. How can I make it resolvable inside the plugins/docker container?
I found some similar issues:
- https://discourse.drone.io/t/dns-lookup-fails-inside-plugins-docker-build/501/5
- https://github.com/drone-plugins/drone-docker/issues/193
but they are slightly differences.
Look at this: http://plugins.drone.io/drone-plugins/drone-docker/
How to run a pipeline step only when pushing to a new branch?
2021-01-07
GitHub sends push hook when pushing to a new branch and merging a PR. How can we distinguish between them?
We are running integration test by triggering a downstream build when a PR is merged into specific branches. In the downstream repository, we pull all the docker images which has been built and pushed from upstream. The thing is we also used the drone-convert-pathschanged to only publish what modules has been changed.
So, what happens when pushing to a new release-* branch?
How to perform integration testing in Go?
2020-09-29
Integration testing can be triggered by using Drone downstream plugin:
steps:
- name: trigger
image: plugins/downstream:linux-amd64
settings:
params:
- COMMIT_BRANCH=${DRONE_COMMIT_BRANCH}
repositories:
- repo/integration-test@${DRONE_COMMIT_BRANCH}
server: https://drone.example.com
token:
from_secret: drone_token
It can be separated with unit tests by using build tags:
// +build integration
package webserver_test
Then we can write code to perform integration test as usual.
How to trigger build steps based on modified directory?
2020-06-26
Using monorepo with multiple micro services, every single commit will trigger a full lint/test/build/publish for every service. What can I do to limit the scope?
To do that, we can use git diff to show changes between commits:
if [[ -n "${DRONE_PULL_REQUEST}" ]]; then
most_recent_before="origin/${DRONE_TARGET_BRANCH}"
elif [[ "${DRONE_BUILD_EVENT}" = "push" && ("${DRONE_COMMIT_BRANCH}" = "master" || "${DRONE_COMMIT_BRANCH}" = "release-"*) ]]; then
if [[ "${DRONE_COMMIT_BEFORE}" = "$zero" ]]; then
exit 0
else
most_recent_before="${DRONE_COMMIT_BEFORE}"
fi
fi
modified_files=$(git --no-pager diff --name-only "${DRONE_COMMIT_SHA}".."${most_recent_before}");
Drone build is not triggered after pushing code to Gitea?
2020-05-06
I pushed code to Gitea and nothing happens in Drone. Why?
But if I go to Settings -> Webhooks, then click “Test Delivery” -> build pipeline will be executed. Why?
First, look at the “Recent Deliveries” to see if a webhook is triggerd here when you pushing code. In my case, it’s not. So, looks like the problem is on Gitea side.
By pay close attention to the git output when pushing:
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 2.02 KiB | 2.02 MiB/s, done.
Total 4 (delta 2), reused 0 (delta 0)
hint: The 'hooks/pre-receive' hook was ignored because it's not set as executable.
hint: You can disable this warning with `git config advice.ignoredHook false`.
hint: The 'hooks/update' hook was ignored because it's not set as executable.
hint: You can disable this warning with `git config advice.ignoredHook false`.
hint: The 'hooks/post-receive' hook was ignored because it's not set as executable.
hint: You can disable this warning with `git config advice.ignoredHook false`.
To gitea.pi:quanta/blog.git
+ d29f63d...47e9ed3 master -> master (forced update)
Quan Tong