Browse Source

fix drone.yml to be like base

rc/16.0-MYC-INIT
Valentin Lab 4 years ago
parent
commit
0850cc42e7
  1. 36
      .drone.yml

36
.drone.yml

@ -1,10 +1,13 @@
kind: pipeline kind: pipeline
name: build name: build
clone: clone:
depth: 1 depth: 1
steps: steps:
- name: build - name: build
image: docker.0k.io/0k-mirror-freezer image: docker.0k.io/0k-mirror-freezer
volumes: volumes:
@ -19,7 +22,10 @@ steps:
docker_config_json: {from_secret: DOCKER_CONFIG_JSON} docker_config_json: {from_secret: DOCKER_CONFIG_JSON}
commands: commands:
- | - |
echo "BUILDING ON: ${DRONE_SYSTEM_HOSTNAME}"
ip=$(curl -q myip.kal.fr 2>/dev/null)
name=$(dig -x "$ip" +short)
echo "===== BUILDING ON: ${DRONE_SYSTEM_HOSTNAME}"
echo "===== SLAVE: $name ($ip)"
- | - |
mkdir -p /root/.ssh mkdir -p /root/.ssh
cat <<EOF > /root/.ssh/config cat <<EOF > /root/.ssh/config
@ -28,11 +34,17 @@ steps:
Port 10022 Port 10022
EOF EOF
- DEBUG=1 freeze docker.0k.io git.0k.io:/var/git/mirror - DEBUG=1 freeze docker.0k.io git.0k.io:/var/git/mirror
- docker push "$(cat image)" ## this will push the new onbuild image
- docker push "docker.0k.io/mirror/odoo/$(cat release)"
- docker tag "docker.0k.io/mirror/odoo/$(cat
release)" "docker.0k.io/mirror/odoo:${DRONE_COMMIT_BRANCH//\//_}"
- docker push "docker.0k.io/mirror/odoo:${DRONE_COMMIT_BRANCH//\//_}"
- |
echo "====== PUSHING onbuild freezed (and patched) IMAGE: $(cat image)"
docker push "$(cat image)" ## this will push the new onbuild image
- |
image="docker.0k.io/mirror/odoo:${DRONE_COMMIT_BRANCH//\//_}"
release="docker.0k.io/mirror/odoo/$(cat release)"
echo "PUSHING IMAGE: $release"
docker push "$release"
echo "TAGGING AND PUSHING: $image"
docker tag "$release" "$image"
docker push "$image"
## Warning: without 'ssh://', the port doesn't see to be used and it tries to ## Warning: without 'ssh://', the port doesn't see to be used and it tries to
## connect to git.0k.io:22 (ssh fingerprint allows to infer this). ## connect to git.0k.io:22 (ssh fingerprint allows to infer this).
- | - |
@ -52,13 +64,21 @@ steps:
url: {from_secret: ROCKETCHAT_URL} url: {from_secret: ROCKETCHAT_URL}
user_id: {from_secret: ROCKETCHAT_USER_ID} user_id: {from_secret: ROCKETCHAT_USER_ID}
token: {from_secret: ROCKETCHAT_TOKEN} token: {from_secret: ROCKETCHAT_TOKEN}
channel: "#odoo_releases"
channel: '#odoo_releases'
commands: commands:
- release=$(cat release) - release=$(cat release)
- | - |
## DRONE will substitute bash variables BEFORE bash ## DRONE will substitute bash variables BEFORE bash
export COMMIT_MESSAGE=$(echo -e ${DRONE_COMMIT_MESSAGE} | head -n 1) export COMMIT_MESSAGE=$(echo -e ${DRONE_COMMIT_MESSAGE} | head -n 1)
- | - |
## DRONE will wrongly try to display the code of this step, actually
## running things in backticks to display " + command " on stdout.
## Mainly because it didn't quote backticks, but quoted backslash.
## Drone actually run this docker by injecting a /usr/drone/bin/init
## with code from these commands, but also an 'echo + command' line
## just before.
## This won't have any consequences in this step apart from annoying
## error messages in drone step output
export MESSAGE="{{#success build.status}}✅{{else}}❌{{/success}} Build {{build.status}} \ export MESSAGE="{{#success build.status}}✅{{else}}❌{{/success}} Build {{build.status}} \
// *Summary:* $COMMIT_MESSAGE [ _${DRONE_COMMIT_AUTHOR_NAME}_ ] // *Summary:* $COMMIT_MESSAGE [ _${DRONE_COMMIT_AUTHOR_NAME}_ ]
build: [{{build.number}}]({{build.link}}) / branch: \`{{build.branch}}\` / \ build: [{{build.number}}]({{build.link}}) / branch: \`{{build.branch}}\` / \
@ -76,6 +96,8 @@ steps:
- success - success
- failure - failure
volumes: volumes:
- name: docker - name: docker
host: host:

Loading…
Cancel
Save