github.com/apache/beam/sdks/v2@v2.48.2/python/scripts/run_snapshot_publish.sh (about)

     1  #!/bin/bash
     2  #
     3  #    Licensed to the Apache Software Foundation (ASF) under one or more
     4  #    contributor license agreements.  See the NOTICE file distributed with
     5  #    this work for additional information regarding copyright ownership.
     6  #    The ASF licenses this file to You under the Apache License, Version 2.0
     7  #    (the "License"); you may not use this file except in compliance with
     8  #    the License.  You may obtain a copy of the License at
     9  #
    10  #       http://www.apache.org/licenses/LICENSE-2.0
    11  #
    12  #    Unless required by applicable law or agreed to in writing, software
    13  #    distributed under the License is distributed on an "AS IS" BASIS,
    14  #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15  #    See the License for the specific language governing permissions and
    16  #    limitations under the License.
    17  #
    18  
    19  BUCKET=gs://beam-python-nightly-snapshots
    20  
    21  VERSION=$(awk '/__version__/{print $3}' $WORKSPACE/src/sdks/python/apache_beam/version.py)
    22  VERSION=$(echo $VERSION | cut -c 2- | rev | cut -c 2- | rev)
    23  time=$(date +"%Y-%m-%dT%H:%M:%S")
    24  SNAPSHOT="apache-beam-$VERSION-$time.zip"
    25  
    26  DEP_SNAPSHOT_ROOT="$BUCKET/dependency_requirements_snapshot"
    27  DEP_SNAPSHOT_FILE_NAME="beam-py-requirements-$time.txt"
    28  
    29  # Snapshots are built by Gradle task :sdks:python:depSnapshot
    30  # and located under Gradle build directory.
    31  cd $WORKSPACE/src/sdks/python/build
    32  
    33  # Rename the file to be apache-beam-{VERSION}-{datetime}.zip
    34  for file in "apache-beam-$VERSION*.zip"; do
    35    mv $file $SNAPSHOT
    36  done
    37  
    38  # Upload to gcs bucket
    39  gsutil cp $SNAPSHOT $BUCKET/$VERSION/
    40  
    41  # Upload requirements.txt to gcs.
    42  gsutil cp requirements.txt $DEP_SNAPSHOT_ROOT/$DEP_SNAPSHOT_FILE_NAME