def run(self):
        """
        run the plugin
        """
        dockerfile = df_parser(self.workflow.builder.df_path, workflow=self.workflow)

        lines = dockerfile.lines

        if (re.match('^koji/image-build(:.*)?$', dockerfile.baseimage) or
                self.workflow.builder.base_from_scratch):
            base_image_labels = {}
        else:
            try:
                config = self.workflow.builder.base_image_inspect[INSPECT_CONFIG]
            except KeyError:
                message = "base image was not inspected"
                self.log.error(message)
                raise RuntimeError(message)
            else:
                base_image_labels = config["Labels"] or {}

        self.generate_auto_labels(base_image_labels.copy(), dockerfile.labels.copy(),
                                  self.labels.copy())
        # changing dockerfile.labels writes out modified Dockerfile - err on
        # the safe side and make a copy
        self.add_aliases(base_image_labels.copy(), dockerfile.labels.copy(), self.labels.copy())
        if self.info_url_format:
            self.add_info_url(base_image_labels.copy(), dockerfile.labels.copy(),
                              self.labels.copy())

        # correct syntax is:
        #   LABEL "key"="value" "key2"="value2"

        # Make sure to escape '\' and '"' characters.
        try:
            # py3
            env_trans = str.maketrans({'\\': '\\\\',
                                       '"': '\\"'})
        except AttributeError:
            # py2
            env_trans = None

        def escape(s):
            if env_trans:
                return s.translate(env_trans)
            return s.replace('\\', '\\\\').replace('"', '\\"')

        labels = []
        for key, value in self.labels.items():

            if key not in dockerfile.labels or dockerfile.labels[key] != value:

                if key in self.dont_overwrite_if_in_dockerfile and key in dockerfile.labels:
                    self.log.info("denying overwrite of label %r, using from Dockerfile", key)

                elif (key in base_image_labels and
                      key in self.dont_overwrite and
                      key not in dockerfile.labels):
                    self.log.info("denying overwrite of label %r, using from baseimage", key)

                else:
                    label = '"%s"="%s"' % (escape(key), escape(value))
                    self.log.info("setting label %r", label)
                    labels.append(label)

        content = ""
        if labels:
            content = 'LABEL ' + " ".join(labels)
            # put labels at the end of dockerfile (since they change metadata and do not interact
            # with FS, this should cause no harm)
            lines.append('\n' + content + '\n')
            dockerfile.lines = lines

        return content
run the plugin