Beispiel #1
0
    def add_hook(self, save=True):

        if self.user_settings:
            connect = GitLabClient(external_account=self.external_account)
            secret = utils.make_hook_secret()
            hook = connect.add_hook(
                self.user,
                self.repo,
                'web',
                {
                    'url':
                    urlparse.urljoin(
                        hook_domain,
                        os.path.join(self.owner.api_url, 'gitlab', 'hook/')),
                    'content_type':
                    gitlab_settings.HOOK_CONTENT_TYPE,
                    'secret':
                    secret,
                },
                events=gitlab_settings.HOOK_EVENTS,
            )

            if hook:
                self.hook_id = hook.id
                self.hook_secret = secret
                if save:
                    self.save()
Beispiel #2
0
    def add_hook(self, save=True):

        if self.user_settings:
            connect = GitLabClient(external_account=self.external_account)
            secret = utils.make_hook_secret()
            hook = connect.add_hook(
                self.user, self.repo,
                'web',
                {
                    'url': urlparse.urljoin(
                        hook_domain,
                        os.path.join(
                            self.owner.api_url, 'gitlab', 'hook/'
                        )
                    ),
                    'content_type': gitlab_settings.HOOK_CONTENT_TYPE,
                    'secret': secret,
                },
                events=gitlab_settings.HOOK_EVENTS,
            )

            if hook:
                self.hook_id = hook.id
                self.hook_secret = secret
                if save:
                    self.save()