use of com.redhat.jenkins.plugins.ci.integration.fixtures.FedmsgRelayContainer in project jms-messaging-plugin by jenkinsci.
the class FedMsgMessagingPluginIntegrationTest method testTriggeringUsingFedMsgLogger.
@Test
public void testTriggeringUsingFedMsgLogger() throws Exception {
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.getBuildersList().add(new Shell("echo CI_MESSAGE = $CI_MESSAGE"));
attachTrigger(new CIBuildTrigger(true, Collections.singletonList(new FedMsgSubscriberProviderData("test", new MessagingProviderOverrides("org.fedoraproject.dev.logger.log"), Collections.singletonList(new MsgCheck("compose", ".+compose_id.+message.+")), "CI_MESSAGE", 60))), jobA);
// Allow for connection
Thread.sleep(5000);
File privateKey = File.createTempFile("ssh", "key");
FileUtils.copyURLToFile(FedmsgRelayContainer.class.getResource("FedmsgRelayContainer/unsafe"), privateKey);
Files.setPosixFilePermissions(privateKey.toPath(), singleton(OWNER_READ));
File ssh = File.createTempFile("jenkins", "ssh");
FileUtils.writeStringToFile(ssh, "#!/bin/sh\n" + "exec ssh -o StrictHostKeyChecking=no -i " + privateKey.getAbsolutePath() + " fedmsg2@" + fedmsgRelay.getSshIPAndPort() + " fedmsg-logger " + " \"$@\"");
Files.setPosixFilePermissions(ssh.toPath(), new HashSet<>(Arrays.asList(OWNER_READ, OWNER_EXECUTE)));
System.out.println(FileUtils.readFileToString(ssh));
ProcessBuilder gitLog1Pb = new ProcessBuilder(ssh.getAbsolutePath(), "--message='{\"compose\": " + "{\"compose_id\": \"This is a message.\"}}'", "--json-input");
String output = stringFrom(logProcessBuilderIssues(gitLog1Pb, "ssh"));
System.out.println(output);
Thread.sleep(2000);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(jobA.getLastBuild());
j.assertLogContains("This is a message", jobA.getLastBuild());
}
use of com.redhat.jenkins.plugins.ci.integration.fixtures.FedmsgRelayContainer in project jms-messaging-plugin by jenkinsci.
the class FedMsgMessagingPluginIntegrationTest method testTriggerWithComplexCheck.
@Test
public void testTriggerWithComplexCheck() throws Exception {
String packages = "(acl|atk|atomic|atomic-devmode|attr|audit|erlang|audit-libs|authconfig|avahi|basesystem|bash|bash-completion|bind|bind99|biosdevname|boost|bridge-utils|bwidget|bzip2|ca-certificates|cairo|c-ares|ceph|checkpolicy|chkconfig|chrony|cloud-init|cloud-utils|cockpit|conntrack-tools|container-selinux|coreutils|cpio|cracklib|criu|crypto-policies|cryptsetup|cups|curl|cyrus-sasl|dbus|dbus-glib|dbus-python|dejavu-fonts|deltarpm|device-mapper-libs|device-mapper-multipath|device-mapper-persistent-data|dhcp|diffutils|ding-libs|dmidecode|dnf|dnsmasq|docker|dracut|dracut-network|e2fsprogs|efibootmgr|efivar|elfutils|emacs|etcd|ethtool|euca2ools|expat|fedora-logos|fedora-release|fedora-repos|file|filesystem|findutils|fipscheck|fipscheck-lib|flannel|fontconfig|fontpackages|freetype|fuse|gawk|gc|gcc|gdbm|gdisk|gdk-pixbuf2|GeoIP|GeoIP-GeoLite-data|gettext|glib2|glibc|glib-networking|glusterfs|gmp|gnupg|gnupg2|gnutls|gobject-introspection|gomtree|gperftools|gpgme|gpm|gpm-libs|graphite2|grep|grub2|gsettings-desktop-schemas|gssproxy|guile|gzip|harfbuzz|hawkey|hdparm|hicolor-icon-theme|hostname|http-parser|hwdata|initscripts|ipcalc|iproute|iptables|iputils|irqbalance|iscsi-initiator-utils|jansson|jasper|jbigkit|json-glib|kernel|kexec-tools|keyutils|keyutils-libs|kmod|krb5|krb5-libs|kubernetes|less|libacl|libaio|libarchive|libassuan|libatomic_ops|libblkid|libbsd|libcap|libcap-ng|libcgroup|libcom_err|libcomps|libcroco|libdatrie|libdb|libdrm|libedit|liberation-fonts|libev|libevent|libffi|libgcrypt|libglade2|libglvnd|libgpg-error|libgudev|libICE|libidn|libidn2|libiscsi|libjpeg-turbo|libksba|libldb|libmetalink|libmnl|libmodman|libmount|libndp|libnet|libnetfilter_conntrack|libnetfilter_cthelper|libnetfilter_cttimeout|libnetfilter_queue|libnfnetlink|libnfs|libnfsidmap|libnl3|libpcap|libpciaccess|libpng|libproxy|libpsl|libpwquality|librepo|libreport|libseccomp|libselinux|libsemanage|libsepol|libsigsegv|libSM|libsolv|libsoup|libssh2|libtalloc|libtasn1|libtdb|libtevent|libthai|libtiff|libtirpc|libtomcrypt|libtommath|libtool|libunistring|libunwind|libusb|libusbx|libuser|libutempter|libverto|libX11|libXau|libxcb|libXcomposite|libXcursor|libXdamage|libXext|libXfixes|libXft|libXi|libXinerama|libxml2|libXmu|libXrandr|libXrender|libxshmfence|libxslt|libXt|libXxf86misc|libXxf86vm|libyaml|linux-firmware|logrotate|lttng-ust|lua|lvm2|lz4|lzo|make|mcpp|mdadm|mesa|mokutil|mozjs17|mpfr|nano|ncurses|nettle|net-tools|NetworkManager|newt|nfs-utils|nghttp2|nmap|npth|nspr|nss|nss-pem|nss-softokn|nss-util|numactl|openldap|openssh|openssl|os-prober|ostree|p11-kit|pam|pango|passwd|pciutils|pcre|perl|perl-libs|pixman|policycoreutils|polkit|polkit-pkla-compat|popt|ppp|procps-ng|protobuf-c|publicsuffix-list|pygobject3|pyliblzma|pyserial|python|python3|python-beautifulsoup4|python-cffi|python-chardet|python-configobj|python-crypto|python-cryptography|python-cssselect|python-dateutil|python-decorator|python-dmidecode|python-docker-py|python-docker-pycreds|python-enum34|python-ethtool|python-html5lib|python-idna|python-iniparse|python-ipaddress|python-IPy|python-jinja2|python-jsonpatch|python-jsonpointer|python-lxml|python-markupsafe|python-oauthlib|python-paramiko|python-pip|python-ply|python-prettytable|python-progressbar|python-pyasn1|python-pycparser|python-pycurl|python-pygpgme|python-pysocks|python-pyudev|python-requestbuilder|python-requests|python-rhsm|python-setuptools|python-six|python-slip|python-urlgrabber|python-urllib3|python-websocket-client|pyxattr|PyYAML|qemu|qrencode|quota|readline|rpcbind|rpm|rsync|runc|samba|sed|selinux-policy|setools|setup|sgml-common|shadow-utils|shared-mime-info|shim-signed|skopeo|skopeo-containers|slang|snappy|socat|sqlite|sssd|subscription-manager|sudo|systemd|tar|tcl|tcp_wrappers|tcp_wrappers-libs|texinfo|tk|tmux|tuned|tzdata|usermode|userspace-rcu|ustr|util-linux|vim|virt-what|wayland|which|xfsprogs|xorg-x11-server-utils|xorg-x11-xauth|xorg-x11-xinit|xz|yum|yum-metadata-parser|zlib)";
FreeStyleProject jobA = j.createFreeStyleProject();
jobA.getBuildersList().add(new Shell("echo CI_MESSAGE = $CI_MESSAGE"));
attachTrigger(new CIBuildTrigger(true, Collections.singletonList(getSubscriberProviderData("org.fedoraproject.dev.logger.log", null, null, new MsgCheck("$.commit.repo", packages)))), jobA);
File privateKey = File.createTempFile("ssh", "key");
FileUtils.copyURLToFile(FedmsgRelayContainer.class.getResource("FedmsgRelayContainer/unsafe"), privateKey);
Files.setPosixFilePermissions(privateKey.toPath(), singleton(OWNER_READ));
File ssh = File.createTempFile("jenkins", "ssh");
FileUtils.writeStringToFile(ssh, "#!/bin/sh\n" + "exec ssh -o StrictHostKeyChecking=no -i " + privateKey.getAbsolutePath() + " fedmsg2@" + fedmsgRelay.getSshIPAndPort() + " fedmsg-logger " + " \"$@\"");
Files.setPosixFilePermissions(ssh.toPath(), new HashSet<>(Arrays.asList(OWNER_READ, OWNER_EXECUTE)));
System.out.println(FileUtils.readFileToString(ssh));
ProcessBuilder gitLog1Pb = new ProcessBuilder(ssh.getAbsolutePath(), "--message='{\"commit\": " + "{\"branch\": \"f26\", " + " \"repo\": \"erlang\"" + "}\n" + "}\'", "--json-input");
String output = stringFrom(logProcessBuilderIssues(gitLog1Pb, "ssh"));
System.out.println(output);
waitUntilScheduledBuildCompletes();
FreeStyleBuild lastBuild = jobA.getLastBuild();
j.assertBuildStatusSuccess(lastBuild);
j.assertLogContains("erlang", lastBuild);
}
use of com.redhat.jenkins.plugins.ci.integration.fixtures.FedmsgRelayContainer in project jms-messaging-plugin by jenkinsci.
the class FedMsgMessagingPluginIntegrationTest method sendFedMsgMessageUsingLogger.
@SuppressWarnings("unused")
private void sendFedMsgMessageUsingLogger(String message) throws Exception {
File privateKey = File.createTempFile("ssh", "key");
FileUtils.copyURLToFile(FedmsgRelayContainer.class.getResource("FedmsgRelayContainer/unsafe"), privateKey);
Files.setPosixFilePermissions(privateKey.toPath(), singleton(OWNER_READ));
File ssh = File.createTempFile("jenkins", "ssh");
FileUtils.writeStringToFile(ssh, "#!/bin/sh\n" + "exec ssh -o StrictHostKeyChecking=no -i " + privateKey.getAbsolutePath() + " fedmsg2@" + fedmsgRelay.getIpAddress() + " fedmsg-logger " + " \"$@\"");
Files.setPosixFilePermissions(ssh.toPath(), new HashSet<>(Arrays.asList(OWNER_READ, OWNER_EXECUTE)));
System.out.println(FileUtils.readFileToString(ssh));
ProcessBuilder gitLog1Pb = new ProcessBuilder(ssh.getAbsolutePath(), "--message='" + message + "'", // + "{\"compose_id\": \"This is a message.\"}}\'",
"--json-input");
String output = stringFrom(logProcessBuilderIssues(gitLog1Pb, "ssh"));
System.out.println(output);
}
use of com.redhat.jenkins.plugins.ci.integration.fixtures.FedmsgRelayContainer in project jms-messaging-plugin by jenkinsci.
the class FedMsgMessagingPluginIntegrationTest method testTriggerWithPipelineComplexCheck.
@Test
public void testTriggerWithPipelineComplexCheck() throws Exception {
String packages = "(acl|atk|atomic|atomic-devmode|attr|audit|erlang|audit-libs|authconfig|avahi|basesystem|bash|bash-completion|bind|bind99|biosdevname|boost|bridge-utils|bwidget|bzip2|ca-certificates|cairo|c-ares|ceph|checkpolicy|chkconfig|chrony|cloud-init|cloud-utils|cockpit|conntrack-tools|container-selinux|coreutils|cpio|cracklib|criu|crypto-policies|cryptsetup|cups|curl|cyrus-sasl|dbus|dbus-glib|dbus-python|dejavu-fonts|deltarpm|device-mapper-libs|device-mapper-multipath|device-mapper-persistent-data|dhcp|diffutils|ding-libs|dmidecode|dnf|dnsmasq|docker|dracut|dracut-network|e2fsprogs|efibootmgr|efivar|elfutils|emacs|etcd|ethtool|euca2ools|expat|fedora-logos|fedora-release|fedora-repos|file|filesystem|findutils|fipscheck|fipscheck-lib|flannel|fontconfig|fontpackages|freetype|fuse|gawk|gc|gcc|gdbm|gdisk|gdk-pixbuf2|GeoIP|GeoIP-GeoLite-data|gettext|glib2|glibc|glib-networking|glusterfs|gmp|gnupg|gnupg2|gnutls|gobject-introspection|gomtree|gperftools|gpgme|gpm|gpm-libs|graphite2|grep|grub2|gsettings-desktop-schemas|gssproxy|guile|gzip|harfbuzz|hawkey|hdparm|hicolor-icon-theme|hostname|http-parser|hwdata|initscripts|ipcalc|iproute|iptables|iputils|irqbalance|iscsi-initiator-utils|jansson|jasper|jbigkit|json-glib|kernel|kexec-tools|keyutils|keyutils-libs|kmod|krb5|krb5-libs|kubernetes|less|libacl|libaio|libarchive|libassuan|libatomic_ops|libblkid|libbsd|libcap|libcap-ng|libcgroup|libcom_err|libcomps|libcroco|libdatrie|libdb|libdrm|libedit|liberation-fonts|libev|libevent|libffi|libgcrypt|libglade2|libglvnd|libgpg-error|libgudev|libICE|libidn|libidn2|libiscsi|libjpeg-turbo|libksba|libldb|libmetalink|libmnl|libmodman|libmount|libndp|libnet|libnetfilter_conntrack|libnetfilter_cthelper|libnetfilter_cttimeout|libnetfilter_queue|libnfnetlink|libnfs|libnfsidmap|libnl3|libpcap|libpciaccess|libpng|libproxy|libpsl|libpwquality|librepo|libreport|libseccomp|libselinux|libsemanage|libsepol|libsigsegv|libSM|libsolv|libsoup|libssh2|libtalloc|libtasn1|libtdb|libtevent|libthai|libtiff|libtirpc|libtomcrypt|libtommath|libtool|libunistring|libunwind|libusb|libusbx|libuser|libutempter|libverto|libX11|libXau|libxcb|libXcomposite|libXcursor|libXdamage|libXext|libXfixes|libXft|libXi|libXinerama|libxml2|libXmu|libXrandr|libXrender|libxshmfence|libxslt|libXt|libXxf86misc|libXxf86vm|libyaml|linux-firmware|logrotate|lttng-ust|lua|lvm2|lz4|lzo|make|mcpp|mdadm|mesa|mokutil|mozjs17|mpfr|nano|ncurses|nettle|net-tools|NetworkManager|newt|nfs-utils|nghttp2|nmap|npth|nspr|nss|nss-pem|nss-softokn|nss-util|numactl|openldap|openssh|openssl|os-prober|ostree|p11-kit|pam|pango|passwd|pciutils|pcre|perl|perl-libs|pixman|policycoreutils|polkit|polkit-pkla-compat|popt|ppp|procps-ng|protobuf-c|publicsuffix-list|pygobject3|pyliblzma|pyserial|python|python3|python-beautifulsoup4|python-cffi|python-chardet|python-configobj|python-crypto|python-cryptography|python-cssselect|python-dateutil|python-decorator|python-dmidecode|python-docker-py|python-docker-pycreds|python-enum34|python-ethtool|python-html5lib|python-idna|python-iniparse|python-ipaddress|python-IPy|python-jinja2|python-jsonpatch|python-jsonpointer|python-lxml|python-markupsafe|python-oauthlib|python-paramiko|python-pip|python-ply|python-prettytable|python-progressbar|python-pyasn1|python-pycparser|python-pycurl|python-pygpgme|python-pysocks|python-pyudev|python-requestbuilder|python-requests|python-rhsm|python-setuptools|python-six|python-slip|python-urlgrabber|python-urllib3|python-websocket-client|pyxattr|PyYAML|qemu|qrencode|quota|readline|rpcbind|rpm|rsync|runc|samba|sed|selinux-policy|setools|setup|sgml-common|shadow-utils|shared-mime-info|shim-signed|skopeo|skopeo-containers|slang|snappy|socat|sqlite|sssd|subscription-manager|sudo|systemd|tar|tcl|tcp_wrappers|tcp_wrappers-libs|texinfo|tk|tmux|tuned|tzdata|usermode|userspace-rcu|ustr|util-linux|vim|virt-what|wayland|which|xfsprogs|xorg-x11-server-utils|xorg-x11-xauth|xorg-x11-xinit|xz|yum|yum-metadata-parser|zlib)";
WorkflowJob wait = j.jenkins.createProject(WorkflowJob.class, "wait");
wait.setDefinition(new CpsFlowDefinition("node('master') {\n def scott = waitForCIMessage providerName: 'test'," + " checks: [[expectedValue: '" + packages + "', field: '$.commit.repo']]," + " overrides: [topic: 'org.fedoraproject.dev.logger.log']" + "\necho \"scott = \" + scott}", true));
scheduleAwaitStep(wait);
File privateKey = File.createTempFile("ssh", "key");
FileUtils.copyURLToFile(FedmsgRelayContainer.class.getResource("FedmsgRelayContainer/unsafe"), privateKey);
Files.setPosixFilePermissions(privateKey.toPath(), singleton(OWNER_READ));
File ssh = File.createTempFile("jenkins", "ssh");
FileUtils.writeStringToFile(ssh, "#!/bin/sh\n" + "exec ssh -o StrictHostKeyChecking=no -i " + privateKey.getAbsolutePath() + " fedmsg2@" + fedmsgRelay.getSshIPAndPort() + " fedmsg-logger " + " \"$@\"");
Files.setPosixFilePermissions(ssh.toPath(), new HashSet<>(Arrays.asList(OWNER_READ, OWNER_EXECUTE)));
System.out.println(FileUtils.readFileToString(ssh));
ProcessBuilder gitLog1Pb = new ProcessBuilder(ssh.getAbsolutePath(), "--message='{\"commit\": " + "{\"branch\": \"f26\", " + " \"repo\": \"erlang\"" + "}\n" + "}\'", "--json-input");
String output = stringFrom(logProcessBuilderIssues(gitLog1Pb, "ssh"));
System.out.println(output);
Thread.sleep(2000);
waitUntilScheduledBuildCompletes();
j.assertBuildStatusSuccess(wait.getLastBuild());
j.assertLogContains("erlang", wait.getLastBuild());
}
Aggregations