Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
fanny-jiang committed Jan 5, 2024
1 parent 04d1a6b commit ceebb29
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 165 deletions.
226 changes: 113 additions & 113 deletions .github/workflows/publish-community-operators-base.yml
Original file line number Diff line number Diff line change
@@ -1,113 +1,113 @@
name: publish_community_operators

on:
workflow_call:
inputs:
community_repo:
type: boolean
required: true
org:
type: string
required: true
repo:
type: string
required: true
dir:
type: string
required: false
secrets:
GH_ROBOT_TOKEN:
required: true

jobs:
create-pull-request:
runs-on: ubuntu-latest
env:
GH_REF_NAME: vX.Y.Z # placeholder for testing
BRANCH_NAME_BASE: ${{ github.actor }}/datadog-operator
ACTIONS_RUNNER_DEBUG: true
steps:
- name: setup env
run: |
echo "VERSION=${GH_REF_NAME:1:5}" >> $GITHUB_ENV
echo "COMMUNITY_BRANCH_NAME=$BRANCH_NAME_BASE-$GH_REF_NAME" >> $GITHUB_ENV
echo "TARGET_GH_ORG=${{ inputs.org }}" >> $GITHUB_ENV
echo "TARGET_GH_REPO=${{ inputs.repo }}" >> $GITHUB_ENV
echo "BUNDLE_PATH=bundle" >> $GITHUB_ENV
if [[ ${{ inputs.community_repo }} == false ]]; then
mkdir ~/.redhat
echo -n "${{ secrets.REDHAT_TOKEN }}" | base64 --decode > ~/.redhat/auths.json
ls ~/.redhat/auths.json
du -sh ~/.redhat/auths.json
if [[ "${{ inputs.repo }}" == "redhat-marketplace-operators" ]]; then
echo "BUNDLE_PATH=bundle-redhat-mp" >> $GITHUB_ENV
elif [[ "${{ inputs.repo }}" == "certified-operators" ]]; then
echo "BUNDLE_PATH=bundle-redhat" >> $GITHUB_ENV
fi
fi
- name: validate env
run: |
echo "$VERSION"
echo "$COMMUNITY_BRANCH_NAME"
echo "$TARGET_GH_ORG"
echo "$TARGET_GH_REPO"
echo "$BUNDLE_PATH"
- name: sync fork
env:
GH_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}
run: |
echo $PWD
gh repo sync DataDog/${{ inputs.repo }} --branch $COMMUNITY_BRANCH_NAME \
--source ${{ inputs.org }}/${{ inputs.repo }} \
--force
- name: checkout fork
uses: actions/checkout@v4
with:
repository: DataDog/${{ inputs.repo }}
token: ${{ secrets.GH_ROBOT_TOKEN }}

- name: checkout datadog-operator to tmp/ dir
uses: actions/checkout@v4
with:
repository: Datadog/datadog-operator
token: ${{secrets.GH_ROBOT_TOKEN}}
path: tmp/

- name: update bundle
env:
REDHAT_TOKEN: ${{ secrets.REDHAT_TOKEN }}
shell: bash
run: |
if [[ ${{ inputs.community_repo }} == false ]]; then
skopeo login -v --authfile ~/.redhat/auths.json registry.connect.redhat.com
make -C ./tmp bundle-redhat
fi
mkdir operators/$OPERATOR_DIR/$VERSION
cp -R ./tmp/$BUNDLE_PATH/* operators/${{ inputs.dir }}/$VERSION
rm -rf ./tmp
- name: Configure git user
run: |
git config --global user.name ${{ github.actor }}
git config --global user.email ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
- name: create PR
env:
GH_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}
run: |
message="operator datadog-operator ($VERSION)"
body="operator datadog-operator ($VERSION)"
git checkout -b $COMMUNITY_BRANCH_NAME
git add -A
git commit -s -m "$message"
git push -f --set-upstream origin $COMMUNITY_BRANCH_NAME
gh pr create --title "$message" \
--body "$body" \
--repo DataDog/${{ inputs.repo }} \
--base main \
--draft
#name: publish_community_operators
#
#on:
# workflow_call:
# inputs:
# community_repo:
# type: boolean
# required: true
# org:
# type: string
# required: true
# repo:
# type: string
# required: true
# dir:
# type: string
# required: false
# secrets:
# GH_ROBOT_TOKEN:
# required: true
#
#jobs:
# create-pull-request:
# runs-on: ubuntu-latest
# env:
# GH_REF_NAME: vX.Y.Z # placeholder for testing
# BRANCH_NAME_BASE: ${{ github.actor }}/datadog-operator
# ACTIONS_RUNNER_DEBUG: true
# steps:
# - name: setup env
# run: |
# echo "VERSION=${GH_REF_NAME:1:5}" >> $GITHUB_ENV
# echo "COMMUNITY_BRANCH_NAME=$BRANCH_NAME_BASE-$GH_REF_NAME" >> $GITHUB_ENV
# echo "TARGET_GH_ORG=${{ inputs.org }}" >> $GITHUB_ENV
# echo "TARGET_GH_REPO=${{ inputs.repo }}" >> $GITHUB_ENV
# echo "BUNDLE_PATH=bundle" >> $GITHUB_ENV
#
# if [[ ${{ inputs.community_repo }} == false ]]; then
# mkdir ~/.redhat
# echo -n "${{ secrets.REDHAT_TOKEN }}" | base64 --decode > ~/.redhat/auths.json
# ls ~/.redhat/auths.json
# du -sh ~/.redhat/auths.json
#
# if [[ "${{ inputs.repo }}" == "redhat-marketplace-operators" ]]; then
# echo "BUNDLE_PATH=bundle-redhat-mp" >> $GITHUB_ENV
# elif [[ "${{ inputs.repo }}" == "certified-operators" ]]; then
# echo "BUNDLE_PATH=bundle-redhat" >> $GITHUB_ENV
# fi
# fi
#
# - name: validate env
# run: |
# echo "$VERSION"
# echo "$COMMUNITY_BRANCH_NAME"
# echo "$TARGET_GH_ORG"
# echo "$TARGET_GH_REPO"
# echo "$BUNDLE_PATH"
#
# - name: sync fork
# env:
# GH_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}
# run: |
# echo $PWD
# gh repo sync DataDog/${{ inputs.repo }} --branch $COMMUNITY_BRANCH_NAME \
# --source ${{ inputs.org }}/${{ inputs.repo }} \
# --force
#
# - name: checkout fork
# uses: actions/checkout@v4
# with:
# repository: DataDog/${{ inputs.repo }}
# token: ${{ secrets.GH_ROBOT_TOKEN }}
#
# - name: checkout datadog-operator to tmp/ dir
# uses: actions/checkout@v4
# with:
# repository: Datadog/datadog-operator
# token: ${{secrets.GH_ROBOT_TOKEN}}
# path: tmp/
#
# - name: update bundle
# env:
# REDHAT_TOKEN: ${{ secrets.REDHAT_TOKEN }}
# shell: bash
# run: |
# if [[ ${{ inputs.community_repo }} == false ]]; then
# skopeo login -v --authfile ~/.redhat/auths.json registry.connect.redhat.com
# make -C ./tmp bundle-redhat
# fi
# mkdir operators/$OPERATOR_DIR/$VERSION
# cp -R ./tmp/$BUNDLE_PATH/* operators/${{ inputs.dir }}/$VERSION
# rm -rf ./tmp
#
# - name: Configure git user
# run: |
# git config --global user.name ${{ github.actor }}
# git config --global user.email ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
#
# - name: create PR
# env:
# GH_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}
# run: |
# message="operator datadog-operator ($VERSION)"
# body="operator datadog-operator ($VERSION)"
# git checkout -b $COMMUNITY_BRANCH_NAME
# git add -A
# git commit -s -m "$message"
# git push -f --set-upstream origin $COMMUNITY_BRANCH_NAME
# gh pr create --title "$message" \
# --body "$body" \
# --repo DataDog/${{ inputs.repo }} \
# --base main \
# --draft
104 changes: 52 additions & 52 deletions .github/workflows/publish-community-operators.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
name: publish_community_operators

on: [push]

jobs:
k8s-operatorhub--community-operators:
# if: startsWith(github.ref, 'refs/tags/v')
# needs: [ create-release ]
uses: ./.github/workflows/publish-community-operators-base.yml
with:
community_repo: true
org: k8s-operatorhub
repo: community-operators
dir: datadog-operator
secrets:
GH_ROBOT_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}

redhat-openshift-ecosystem--community-operators-prod:
# if: startsWith(github.ref, 'refs/tags/v')
# needs: [ create-release ]
uses: ./.github/workflows/publish-community-operators-base.yml
with:
community_repo: true
org: redhat-openshift-ecosystem
repo: community-operators-prod
dir: datadog-operator
secrets:
GH_ROBOT_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}

redhat-openshift-ecosystem--redhat-marketplace-operators:
# if: startsWith(github.ref, 'refs/tags/v')
# needs: [ create-release ]
uses: ./.github/workflows/publish-community-operators-base.yml
with:
community_repo: false
org: redhat-openshift-ecosystem
repo: redhat-marketplace-operators
dir: datadog-operator-certified-rhmp
secrets:
GH_ROBOT_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}

redhat-openshift-ecosystem--certified-operators:
# if: startsWith(github.ref, 'refs/tags/v')
# needs: [ create-release ]
uses: ./.github/workflows/publish-community-operators-base.yml
with:
community_repo: false
org: redhat-openshift-ecosystem
repo: certified-operators
dir: datadog-operator-certified
secrets:
GH_ROBOT_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}
#name: publish_community_operators
#
#on: [push]
#
#jobs:
# k8s-operatorhub--community-operators:
## if: startsWith(github.ref, 'refs/tags/v')
## needs: [ create-release ]
# uses: ./.github/workflows/publish-community-operators-base.yml
# with:
# community_repo: true
# org: k8s-operatorhub
# repo: community-operators
# dir: datadog-operator
# secrets:
# GH_ROBOT_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}
#
# redhat-openshift-ecosystem--community-operators-prod:
## if: startsWith(github.ref, 'refs/tags/v')
## needs: [ create-release ]
# uses: ./.github/workflows/publish-community-operators-base.yml
# with:
# community_repo: true
# org: redhat-openshift-ecosystem
# repo: community-operators-prod
# dir: datadog-operator
# secrets:
# GH_ROBOT_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}
#
# redhat-openshift-ecosystem--redhat-marketplace-operators:
## if: startsWith(github.ref, 'refs/tags/v')
## needs: [ create-release ]
# uses: ./.github/workflows/publish-community-operators-base.yml
# with:
# community_repo: false
# org: redhat-openshift-ecosystem
# repo: redhat-marketplace-operators
# dir: datadog-operator-certified-rhmp
# secrets:
# GH_ROBOT_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}
#
# redhat-openshift-ecosystem--certified-operators:
## if: startsWith(github.ref, 'refs/tags/v')
## needs: [ create-release ]
# uses: ./.github/workflows/publish-community-operators-base.yml
# with:
# community_repo: false
# org: redhat-openshift-ecosystem
# repo: certified-operators
# dir: datadog-operator-certified
# secrets:
# GH_ROBOT_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}

0 comments on commit ceebb29

Please sign in to comment.