Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Release Drafter and Jenkinsfile with Docker credentials and promotions #860

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 35 additions & 11 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ env:
java-version: '11'
gradle-version: '8.0.2'

permissions:
id-token: write
contents: read

jobs:
draft-a-release:
name: Draft a release
if: github.repository == 'opensearch-project/opensearch-migrations'
runs-on: ubuntu-latest
outputs:
dockerhub-password: ${{ steps.retrieve-values.outputs.dockerhub-password }}
steps:
- uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -48,17 +55,34 @@ jobs:
docker tag migrations/traffic_replayer:latest opensearchstaging/opensearch-migrations-traffic-replayer:${{ steps.get_data.outputs.version }}
docker tag migrations/capture_proxy:latest opensearchstaging/opensearch-migrations-traffic-capture-proxy:${{ steps.get_data.outputs.version }}
docker tag migrations/reindex_from_snapshot:latest opensearchstaging/opensearch-migrations-reindex-from-snapshot:${{ steps.get_data.outputs.version }}
# - name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Push Docker image to Docker Hub
# run: |
# docker push opensearchstaging/opensearch-migrations-console:${{ steps.get_data.outputs.version }}
# docker push opensearchstaging/opensearch-migrations-traffic-replayer:${{ steps.get_data.outputs.version }}
# docker push opensearchstaging/opensearch-migrations-traffic-capture-proxy:${{ steps.get_data.outputs.version }}
# docker push opensearchstaging/opensearch-migrations-reindex-from-snapshot:${{ steps.get_data.outputs.version }}
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.MIGRATIONS_DOCKER_ROLE }}
aws-region: us-east-1
- name: Retrieve Values
id: retrieve-values
run: |
DOCKERHUB_PASSWORD=`aws secretsmanager get-secret-value --secret-id jenkins-staging-dockerhub-credential --query SecretString --output text`
echo "::add-mask::$DOCKERHUB_PASSWORD"
echo "dockerhub-password=$DOCKERHUB_PASSWORD" >> $GITHUB_OUTPUT
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.MIGRATIONS_DOCKER_USERNAME }}
password: ${{ steps.retrieve-values.outputs.dockerhub-password }}
- name: Push Docker image to Docker Hub
run: |
docker push opensearchstaging/opensearch-migrations-console:${{ steps.get_data.outputs.version }}
docker push opensearchstaging/opensearch-migrations-console:latest
docker push opensearchstaging/opensearch-migrations-traffic-replayer:${{ steps.get_data.outputs.version }}
docker push opensearchstaging/opensearch-migrations-traffic-replayer:latest
docker push opensearchstaging/opensearch-migrations-traffic-capture-proxy:${{ steps.get_data.outputs.version }}
docker push opensearchstaging/opensearch-migrations-traffic-capture-proxy:latest
docker push opensearchstaging/opensearch-migrations-reindex-from-snapshot:${{ steps.get_data.outputs.version }}
docker push opensearchstaging/opensearch-migrations-reindex-from-snapshot:latest
- name: Logout to DockerHub
if: always()
run: docker logout
- name: Draft a release
uses: softprops/action-gh-release@v2
with:
Expand Down
144 changes: 144 additions & 0 deletions jenkins/release.jenkinsFile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,150 @@ pipeline {
mavenArtifactsPath: "$WORKSPACE/repository/",
autoPublish: true
)

def dockerCopyHubConsole =
peterzhuamazon marked this conversation as resolved.
Show resolved Hide resolved
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-console'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: "opensearch-migrations-console:${tag}")
]

def dockerCopyHubConsoleLatest =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-console'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: 'opensearch-migrations-console:latest')
]

def dockerCopyHubTrafficReplayer =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-traffic-replayer'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: "opensearch-migrations-traffic-replayer:${tag}")
]

def dockerCopyHubTrafficReplayerLatest =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-console'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: 'opensearch-migrations-traffic-replayer:latest')
]

def dockerCopyHubTrafficCaptureProxy =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-traffic-capture-proxy'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: "opensearch-migrations-traffic-capture-proxy:${tag}")
]

def dockerCopyHubTrafficCaptureProxyLatest =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-traffic-capture-proxy'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: 'opensearch-migrations-traffic-capture-proxy:latest')
]

def dockerCopyHubReindexFromSnapshot =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-reindex-from-snapshot'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: "opensearch-migrations-reindex-from-snapshot:${tag}")
]

def dockerCopyHubReindexFromSnapshotLatest =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-reindex-from-snapshot'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: 'opensearch-migrations-reindex-from-snapshot:latest')
]

def dockerCopyEcrConsole =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-console'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'public.ecr.aws/opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: "opensearch-migrations-console:${tag}")
]

def dockerCopyEcrConsoleLatest =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-console'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'public.ecr.aws/opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: 'opensearch-migrations-console:latest')
]

def dockerCopyEcrTrafficReplayer =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-traffic-replayer'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'public.ecr.aws/opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: "opensearch-migrations-traffic-replayer:${tag}")
]

def dockerCopyEcrTrafficReplayerLatest =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-console'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'public.ecr.aws/opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: 'opensearch-migrations-traffic-replayer:latest')
]

def dockerCopyEcrTrafficCaptureProxy =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-traffic-capture-proxy'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'public.ecr.aws/opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: "opensearch-migrations-traffic-capture-proxy:${tag}")
]

def dockerCopyEcrTrafficCaptureProxyLatest =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-traffic-capture-proxy'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'public.ecr.aws/opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: 'opensearch-migrations-traffic-capture-proxy:latest')
]

def dockerCopyEcrReindexFromSnapshot =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-reindex-from-snapshot'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'public.ecr.aws/opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: "opensearch-migrations-reindex-from-snapshot:${tag}")
]

def dockerCopyEcrReindexFromSnapshotLatest =
build job: 'docker-copy',
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: 'opensearch-migrations-reindex-from-snapshot'),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'public.ecr.aws/opensearchproject'),
string(name: 'DESTINATION_IMAGE', value: 'opensearch-migrations-reindex-from-snapshot:latest')
]
}
}
}
Expand Down
Loading