#9679 ODCS Script changes to generate openh264 repos
Merged 3 years ago by mohanboddu. Opened 3 years ago by mohanboddu.
mohanboddu/releng private-odcs-all-arches  into  master

scripts/odcs/odcs-private-compose.py scripts/odcs-private-compose.py
file renamed
+13 -1
@@ -7,6 +7,17 @@ 

  # Private compose from a tag using odcs

  #

  

+ """

+ 

+ Usage: python odcs-private-compose.py <token> <koji_tag>

+ 

+ This is used to generate private composes using ODCS.

+ This script is specifically used to generate openh264 repos.

+ The compsoe is stored in /srv/odcs/private/ dir on

+ odcs-backend-releng01.iad2.fedoraproject.org

+ 

+ """

+ 

  import argparse

  from odcs.client.odcs import ODCS, AuthMech, ComposeSourceTag

  
@@ -25,5 +36,6 @@ 

  source = ComposeSourceTag(tag)

  

  # Making a private compose with no inheritance

- compose = odcs.request_compose(source, target_dir="private", flags=["no_inheritance"])

+ arches = ["armv7hl", "i686", "x86_64", "aarch64", "ppc64le", "s390x"]

+ compose = odcs.request_compose(source, target_dir="private", arches = arches, flags=["no_inheritance"])

  print(compose)

@@ -0,0 +1,48 @@ 

+ #!/usr/bin/python

+ # -*- coding: utf-8 -*-

+ #

+ # SPDX-License-Identifier:      GPL-2.0

+ # Author: Mohan Boddu <mboddu@bhujji.com>

+ #

+ # Private compose from a tag using odcs

+ #

+ 

+ """

+ 

+ Usage: python odcs-token.py

+ 

+ This is used to generate a token needed to run odcs composes 

+ 

+ """

+ 

+ import openidc_client

+ staging = False

+ 

+ if staging:

+     id_provider = 'https://id.stg.fedoraproject.org/openidc/'

+ else:

+     id_provider = 'https://id.fedoraproject.org/openidc/'

+ 

+ # Get the auth token using the OpenID client.

+ oidc = openidc_client.OpenIDCClient(

+     'odcs',

+     id_provider,

+     {'Token': 'Token', 'Authorization': 'Authorization'},

+     'odcs-authorizer',

+     'notsecret',

+ )

+ 

+ scopes = [

+     'openid',

+     'https://id.fedoraproject.org/scope/groups',

+     'https://pagure.io/odcs/new-compose',

+     'https://pagure.io/odcs/renew-compose',

+     'https://pagure.io/odcs/delete-compose',

+ ]

+ try:

+     token = oidc.get_token(scopes, new_token=True)

+     token = oidc.report_token_issue()

+     print(token)

+ except requests.exceptions.HTTPError as e:

+     print(e.response.text)

+     raise

Pull-Request has been merged by mohanboddu

3 years ago