Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Segy to oVDS Conversion DAG
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
Data Flow
Data Ingestion
Segy to oVDS Conversion DAG
Commits
103ba129
Commit
103ba129
authored
2 years ago
by
Marija Dukic
Browse files
Options
Downloads
Patches
Plain Diff
ci: migrate python image to MCR
parent
1b6e28ba
No related branches found
No related tags found
1 merge request
!76
ci: migrate python image to MCR
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
deployments/scripts/azure/DAG.Dockerfile
+51
-0
51 additions, 0 deletions
deployments/scripts/azure/DAG.Dockerfile
deployments/scripts/azure/Dockerfile
+17
-6
17 additions, 6 deletions
deployments/scripts/azure/Dockerfile
devops/azure/override-stages.yml
+22
-6
22 additions, 6 deletions
devops/azure/override-stages.yml
with
90 additions
and
12 deletions
deployments/scripts/azure/DAG.Dockerfile
0 → 100644
+
51
−
0
View file @
103ba129
FROM
mcr.microsoft.com/mirror/docker/library/python:3.8-slim
ARG
DATA_PARTITION=opendes
ENV
BUILD_PACKAGES \
python3-cryptography
ENV
PYTHONUNBUFFERED=1 \
PATH="/home/osdu/.local/bin:${PATH}" \
DATA_PARTITION=${DATA_PARTITION} \
DAG_DIRECTORY=../airflow/workflow-svc-v2 \
DAG_TASK_IMAGE=${DAG_TASK_IMAGE} \
AZURE_DEPLOYMENTS_SUBDIR=. \
AZURE_DEPLOYMENTS_SCRIPTS_SUBDIR=.
USER
root
RUN
set
-x
\
echo
"**** install Python ****"
&&
\
apt-get update
&&
\
apt-get
install
-y
-o
APT::Keep-Downloaded-Packages
=
false
${
BUILD_PACKAGES
}
&&
\
rm
-rf
/var/cache/apt/archives/
*
# Install Requirements
ADD
deployments/scripts/azure/requirements.txt ./requirements.txt
RUN
pip
install
-r
requirements.txt
# Add debian repo to install busybox package
RUN
\
echo
'@debian http://deb.debian.org/debian'
>>
/etc/apt/repositories
&&
\
echo
'@debian http://deb.debian.org/debian-security'
>>
/etc/apt/repositories
RUN
\
apt-get update
&&
\
apt-get
install
busybox
-y
# Add Scripts
WORKDIR
/home/osdu
ADD
deployments/scripts/azure/*.py scripts/
ADD
deployments/scripts/azure/bootstrap.sh scripts/
RUN
chmod
+x scripts/bootstrap.sh
# Add DAGs
ADD
airflow airflow
# Execute as non root user.
RUN
addgroup
--system
osdu
&&
adduser
--system
osdu
--ingroup
osdu
USER
osdu
WORKDIR
/home/osdu/scripts
ENTRYPOINT
["/home/osdu/scripts/bootstrap.sh"]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
deployments/scripts/azure/Dockerfile
+
17
−
6
View file @
103ba129
FROM
community.opengroup.org:5555/osdu/platform/deployment-and-operations/base-containers-azure/alpine-python3:0.0.2
FROM
mcr.microsoft.com/mirror/docker/library/python:3.8-slim
ARG
DATA_PARTITION=opendes
ARG
DATA_PARTITION=opendes
ENV
BUILD_PACKAGES \
ENV
BUILD_PACKAGES \
py-cryptography
py
thon3
-cryptography
ENV
PYTHONUNBUFFERED=1 \
ENV
PYTHONUNBUFFERED=1 \
PATH="/home/osdu/.local/bin:${PATH}" \
PATH="/home/osdu/.local/bin:${PATH}" \
...
@@ -17,15 +17,25 @@ USER root
...
@@ -17,15 +17,25 @@ USER root
RUN
set
-x
\
RUN
set
-x
\
echo
"**** install Python ****"
&&
\
echo
"**** install Python ****"
&&
\
ap
k
update
&&
\
ap
t-get
update
&&
\
ap
k add
--no-cach
e
${
BUILD_PACKAGES
}
&&
\
ap
t-get
install
-y
-o
APT::Keep-Downloaded-Packages
=
fals
e
${
BUILD_PACKAGES
}
&&
\
rm
-rf
/var/cache/ap
k
/
*
rm
-rf
/var/cache/ap
t/archives
/
*
# Install Requirements
# Install Requirements
ADD
deployments/scripts/azure/requirements.txt ./requirements.txt
ADD
deployments/scripts/azure/requirements.txt ./requirements.txt
RUN
pip
install
-r
requirements.txt
RUN
pip
install
-r
requirements.txt
# Add debian repo to install busybox package
RUN
\
echo
'@debian http://deb.debian.org/debian'
>>
/etc/apt/repositories
&&
\
echo
'@debian http://deb.debian.org/debian-security'
>>
/etc/apt/repositories
RUN
\
apt-get update
&&
\
apt-get
install
busybox
-y
# Add Scripts
# Add Scripts
WORKDIR
/home/osdu
ADD
deployments/scripts/azure/*.py scripts/
ADD
deployments/scripts/azure/*.py scripts/
ADD
deployments/scripts/azure/bootstrap.sh scripts/
ADD
deployments/scripts/azure/bootstrap.sh scripts/
RUN
chmod
+x scripts/bootstrap.sh
RUN
chmod
+x scripts/bootstrap.sh
...
@@ -34,7 +44,8 @@ RUN chmod +x scripts/bootstrap.sh
...
@@ -34,7 +44,8 @@ RUN chmod +x scripts/bootstrap.sh
ADD
airflow airflow
ADD
airflow airflow
# Execute as non root user.
# Execute as non root user.
RUN
addgroup
--system
osdu
&&
adduser
--system
osdu
--ingroup
osdu
USER
osdu
USER
osdu
WORKDIR
/home/osdu/scripts
WORKDIR
/home/osdu/scripts
ENTRYPOINT
["/home/osdu/scripts/bootstrap.sh"]
ENTRYPOINT
["/home/osdu/scripts/bootstrap.sh"]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
devops/azure/override-stages.yml
+
22
−
6
View file @
103ba129
...
@@ -24,7 +24,7 @@ azure_build_dag:
...
@@ -24,7 +24,7 @@ azure_build_dag:
image
:
danielscholl/azure-build-image
image
:
danielscholl/azure-build-image
only
:
only
:
variables
:
variables
:
-
"
$AZURE
==
'
true
'"
-
"
$AZURE
==
'
1
'"
script
:
script
:
-
|
-
|
cat > .env << EOF
cat > .env << EOF
...
@@ -39,7 +39,7 @@ azure_build_dag:
...
@@ -39,7 +39,7 @@ azure_build_dag:
BUILD_VERSION=$CI_COMMIT_SHA
BUILD_VERSION=$CI_COMMIT_SHA
EOF
EOF
docker build -t $CI_REGISTRY_IMAGE/$DAG_TASK_IMAGE --file DAG.Dockerfile .
docker build -t $CI_REGISTRY_IMAGE/$DAG_TASK_IMAGE --file
deployments/scripts/azure/
DAG.Dockerfile .
docker build -t $CI_REGISTRY_IMAGE/$DAG_LOAD_IMAGE --file deployments/scripts/azure/Dockerfile .
docker build -t $CI_REGISTRY_IMAGE/$DAG_LOAD_IMAGE --file deployments/scripts/azure/Dockerfile .
docker push $CI_REGISTRY_IMAGE/$DAG_TASK_IMAGE
docker push $CI_REGISTRY_IMAGE/$DAG_TASK_IMAGE
docker push $CI_REGISTRY_IMAGE/$DAG_LOAD_IMAGE
docker push $CI_REGISTRY_IMAGE/$DAG_LOAD_IMAGE
...
@@ -76,7 +76,7 @@ azure_register_dag:
...
@@ -76,7 +76,7 @@ azure_register_dag:
-
azure_build_dag
-
azure_build_dag
only
:
only
:
variables
:
variables
:
-
"
$AZURE
==
'
true
'"
-
"
$AZURE
==
'
1
'"
script
:
script
:
-
|
-
|
cat > requirements.txt << EOF
cat > requirements.txt << EOF
...
@@ -149,13 +149,28 @@ azure_register_dag:
...
@@ -149,13 +149,28 @@ azure_register_dag:
self.register_dag()
self.register_dag()
def register_dag(self):
def register_dag(self):
data = '{"workflowName":"$DAG_NAME","description":"$DAG_NAME","registrationInstructions":{"dagName":"$DAG_NAME"}}'
# To register DAG workflow name must match pattern ^[a-zA-Z0-9._-]{1,64}$
dag_name = '$DAG_NAME'
formatted_dag_name = dag_name[:63]
data = json.dumps(
{
"workflowName": formatted_dag_name,
"description": formatted_dag_name,
"registrationInstructions":
{
"dagName": formatted_dag_name
}
})
headers = {
headers = {
'Content-Type': 'application/json',
'Content-Type': 'application/json',
'Authorization': self.token,
'Authorization': self.token,
'data-partition-id': self.data_partition_id
'data-partition-id': self.data_partition_id
}
}
print(f"Attempting to register DAG with name {formatted_dag_name}")
response = requests.post(self.workflow_service_url, headers=headers, data=data)
response = requests.post(self.workflow_service_url, headers=headers, data=data)
if response.status_code == 200:
if response.status_code == 200:
workflow_id = response.json().get('workflowId')
workflow_id = response.json().get('workflowId')
...
@@ -164,7 +179,8 @@ azure_register_dag:
...
@@ -164,7 +179,8 @@ azure_register_dag:
workflow_id = response.json().get('workflowId')
workflow_id = response.json().get('workflowId')
print("DAG is already registered with workflowId: {0}".format(workflow_id))
print("DAG is already registered with workflowId: {0}".format(workflow_id))
else:
else:
print("Error while registering DAG {0}".format(response.raise_for_status()))
print(f"Error while registering DAG due to: {response.json().get('message')}")
print("Error: {0}".format(response.raise_for_status()))
if __name__ == "__main__":
if __name__ == "__main__":
RegisterDag().register()
RegisterDag().register()
...
@@ -197,7 +213,7 @@ azure_copy_dag:
...
@@ -197,7 +213,7 @@ azure_copy_dag:
-
azure_register_dag
-
azure_register_dag
only
:
only
:
variables
:
variables
:
-
"
$AZURE
==
'
true
'"
-
"
$AZURE
==
'
1
'"
script
:
script
:
-
|
-
|
# Installing the Azcopy utility
# Installing the Azcopy utility
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment