Beispiel #1
0
 def run_step(self, data):
     # Skip pushing on pull request testing
     if environment.get_pull_request_test():
         return data
     if not environment.get_push_public():
         self.push_image(data)
         self.verify_push(data)
     return data
Beispiel #2
0
 def run_step(self, data):
     # Skip pushing on pull request testing
     if environment.get_pull_request_test():
         return data
     if environment.get_push_public():
         self.push_image(data)
         self.push_image_only_semver(data)
         self.push_latest(data)
     else:
         self.log.info('Skipping to push to public registry')
     return data
Beispiel #3
0
    def run_step(self, data):
        if environment.get_push_public():
            if artifact.should_store():
                self.push_image(data)
            else:
                self.log.info(
                    'Branch not to be publish.')
                slack.send((f'The :git: branch *{data[pipeline_data.IMAGE_NAME]} | '
                                     f' {environment.get_git_branch()}* '
                                     'is not a main branch, nor configured to be push to Docker Hub.'))


        return data
Beispiel #4
0
 def run_step(self, data):
     if environment.get_push_azure() and not environment.get_push_public():
         if artifact.should_store():
             self.push_image(data)
             self.step_ok()
         else:
             self.log.info('Branch not to be publish to Azure CR.')
             slack.send((
                 f'The :git: branch *{data[pipeline_data.IMAGE_NAME]}* | '
                 f' *{environment.get_git_branch()}* '
                 'is not pushed to Azure Registry. It is not the main branch, nor configured to be push.'
             ))
             self.step_skipped()
     return data
Beispiel #5
0
    def run_step(self, data):

        if environment.is_run_inside_docker():
            self.log.info('Logging in to Docker Hub.')
            docker.login_public()

        if (not environment.get_push_public()):
            self.log.info('Logging in to Private Docker Hub.')
            docker.login_private()

            if environment.get_push_azure():
                self.log.info('Logging in to Azure Container Registry.')
                docker.login_azure()

        self.step_ok()

        return data
Beispiel #6
0
    def run_step(self, data):  #pragma: no cover
        '''
        Tag images build with semver like "appname:1.2.3_abcdefg"

        If PUSH_PUBLIC=True then also tag image without git hash "appname:1.2.3"
        '''

        if pipeline_data.IMAGE_TAGS not in data:
            data[pipeline_data.IMAGE_TAGS] = []

        # Default tagging appname:1.2.3_abcdefg
        self.tag(image_version_util.get_image(data), data)

        if environment.get_push_public():
            # Default tagging appname:1.2.3
            self.tag(image_version_util.get_image_only_semver(data), data)
            # Default tagging appname:latest
            self.tag(image_version_util.get_latest_tag(data), data)

        self.step_ok()

        return data
Beispiel #7
0
 def run_step(self, data):
     if (not environment.get_push_azure() and
         not environment.get_push_public()):
         docker.login()
     return data