:licenses-allowed: Comma-separated list of allowed licenses.
For example: Apache-2.0,EPL-1.0,MIT
+lf-infra-capture-instance-metadata
+----------------------------------
+
+Capture instance metadata.
+
lf-infra-create-netrc
---------------------
Provides basic lf-infra recommended publisher configurations which should be
used in all job templates. This primary objective of this trigger is to
-gather build logs and copy them to a log server.
+gather package listing, instance metadata, sar reports, build logs and copy
+them to a log server.
lf-infra-publish-windows
------------------------
- shell: !include-raw-escape:
- ../shell/license-check.sh
+- builder:
+ name: lf-infra-capture-instance-metadata
+ builders:
+ - shell: !include-raw:
+ - ../shell/capture-instance-metadata.sh
+
- builder:
name: lf-infra-create-netrc
builders:
build-steps:
- lf-infra-sysstat
- lf-infra-package-listing
+ - lf-infra-capture-instance-metadata
- lf-infra-ship-logs
mark-unstable-if-failed: true
- workspace-cleanup:
--- /dev/null
+#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2020 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+echo "---> capture-instance-metadata.sh"
+
+# detect if we're in EC2
+if [ -z "${NOMAD_DC}" ]; then
+ echo "INFO: Running in Nomad, no metadata"
+ exit 0
+fi
+
+# detect if we're in AWS
+if grep -qi amazon /sys/devices/virtual/dmi/id/bios_vendor ; then
+ echo "INFO: Running in AWS, not capturing instance metadata"
+ exit 0
+fi
+
+# Retrive OpenStack instace metadata APIs at this IP.
+# The instance id and other metadata is useful for debugging VM.
+echo "INFO: Running in OpenStack, capturing instance metadata"
+curl -s http://169.254.169.254/openstack/latest/meta_data.json \
+ | python -mjson.tool > "$WORKSPACE/archives/instance_meta_data.json"